Dynamics 365 Business Central: How to print image with hyperlink for the selected report
In this blog, let us discuss about ‘how to add image with hyperlink to the report in Business central’.
Consider, if I need to advertise my additional item/product in the report, meaning, when someone buys my product with the product report, I need to advertise my additional product, which is related to the main product, such that, when any user clicks on the product URL, they should be able to browse and explore more about the product and buy in case they are interested in the additional product as well.
Now let’s see how it is done!
- Create a table to add the images.
Here I have created a table called Advertisement-Master and added required fields like “No.”, “Item Description”, “Item URL”, and “Item Image”.
For “Item Image”, the datatype has to be “MediaSet” and one Boolean field to specify in which report product advertisement has to be printed.
You can specify the reports to print Image by enabling and disabling these fields.
2.Create a Page for the table
Add all the above created fields to the page. Below screenshot is my ‘list page’ and I have added all fields to the page.
Item image” can be inserted through “FactBox”, to achieve that, lets create a “CardPart page” to insert the Item Image.
Below screenshot is for the reference to insert “Item Image” through “FactBox”.
Next step is to add “field Image” and added Two actions to Insert and Delete “Item Image”.
In the actions I am calling “ImportFromDevice” procedure and “DeleteItemImage” procedure.
The procedures which I am calling is described below.
3. Add Hyperlink property to the report
To add Hyperlink in the report layout, first hyperlink has to be enabled to achieve this. In the report use the property “EnableHyperlinks” and set it “True”.
Ex: EnableHyperlinks = true;
Below is the example to display “Item Image” in the report.
Inside the “OnAfterGetRecord” trigger, use the below sample code to display image in the report.
4.RDL layout
Open the RDL file and add the “Item Image” column, as shown below.
When the Click action is performed on that image, it will take to the specified URL. To achieve this:
- Go to “Image properties”, by right clicking on the “Item Image column”.
- In the Action section enable ‘Go To URL’ and specify the ‘URL’ under ‘Select URL:’, as shown below.
Save the changes and run the report.
Here is the result:
This is result of the “Item Image page”, here I have enabled “Boolean” fields, to print the image and right side is the “FactBox” where you can insert or delete the image.
So, this is the output of the report printing image, when the user clicks on the image it will take them to the specified URL.
For more details kindly visit our LinkedIn page:
https://www.linkedin.com/company/allgrow-technologies-pvt-ltd/mycompany/
or you can write us on contact@allgrowtech.com
By Manasa. D.
Dynamics 365 Business Central-How to modify the posted transaction.
Description: As we all know that the Business Central do not allow us to modify the posted transaction, means once the transaction has been posted you cannot edit it.
- Considering ‘Item Ledger Entries’ as posted transaction table which is non-editable and in case you need to update any record in there then what we can do.
- Creation of the records happen when we post a Sales Order, Purchase Order or Item Journal Lines.
It is a record created after we post these documents.
- By default, Business Central won’t provide us the permission to alter these posted records.
- But what if anyone wants to modify these records?
- let’s see how it can be done through this blog
Creating a new Table and Page
- First, I created a new table and page with the name “Lot No Info” which contains all the fields I wanted to edit in ILE
- I also added ‘Entry No,’ for this new table and page and made this as a “PK“
- And I wrote a procedure and called that procedure on “OnOpenPage()” trigger of our new page, so whenever this page opens, it should copy all the field details from the ILE to this new page.
- In the above-mentioned procedure, I validated all the fields which I wanted to modify in the ILE.
- So, once I open the page, all the records from the ILE will be copied to our new page. But I wanted all the records of Entry Type – Purchase and Positive Adjustment. That’s why I’ve applied the filter in my code.
- Since I’ve validated the ‘Entry No.’ field, the ‘Entry No.’ field from ILE will be copied to our new page along with all other fields.
- So once all the records are available in our new page, we can modify the field values.
- So, the first half work is done. The next part would be updating the changes what we have made in our new page to the ILE.
- But simply we cannot modify the base table. For that, first we have to provide permission to the base table ‘Item Ledger Entry’ to Read, Modify, Insert, Delete
- After assigning the permission, I’ve created a procedure to copy the records from the new page ‘Lot No Info’ to the ‘Item Ledger Entries’ which is based on the PK ‘Entry No.’
- And this procedure is called under an action in the newly created page ‘Lot No Info’.
- So, when the new page is opened, all the records from the ILE will be copied to our new page. And we modify the some of the records and click on that action.
- After clicking on the action, if we go and check the ILE, we can see the modified records.
- But remember, all the changes are done based on the PK ‘Entry No.’
For more details kindly visit our linkedin page:
https://www.linkedin.com/company/allgrow-technologies-pvt-ltd/mycompany/
or you can write us on contact@allgrowtech.com
By Vinyas. S.