Category Archives: Dynamics 365
Generic way of Attaching Documents on any Record of the Page in Microsoft Dynamics Business Central – Template Code
Problem Statement: In Microsoft Business Central, there is a way to attach attachments only on Documents or Master Table records. But, what if this requirement is for other tables such as Opportunities, custom tables, etc. Introduction: I have seen many developers afraid to touch the attachment-related customization as it seems complicated. Well, I have found a solution and here it goes. In this blog, I’m attempting to create a generic template for code that needs to have an attachment feature on any table that you like using AL Code. This means that you simply cannot copy-paste the same code for all the tables but a simple change in variable sub-type will ease your work significantly Pre-requisites: Microsoft Dynamics Business Central VS Code Al Language Extension Source Code: https://github.com/olisterr/Generic-Attachment-Template Demonstration: 1. How it works: Document Attachment is a table which stores a few things that help in tracking information related to the attachment Document Attachment Table Fields The main unique thing that works for all the different tables is the TableID, Line No and No. fields. Along with this, the document is attached through a stream inside a Media DataType. There are 2 important functions 1. SaveAttachment2 : This function takes a few parameters RecRef for origin Table ID, FileName to store the file name, Blob which will be imported a Stream in Document Reference ID Media type field, Recs.No which will store the unique record for which the attachment is attached. This function when the line has no attachment attached to it. This is done by checking if the field Document Reference ID has no value. SaveAttachment2 2. Export2: This function exports the attached BLOB to a file. This is done if the Document Reference ID field has any value. Export2 This is both functions are complimentary of each other and are trigger on FileName field DrillDown DrillDown to Attach OR Export 2. Things that you need to change: Either you are using the Generic Attachment Template code first time or mulitple times in the same project, you need to find //Change the Table Name Here—-OLISTER and //Change the Page Name Here—-OLISTER comment and replace your table name. Also, you will need to manage with the PageName and IDs. Read through README.TXT in the project. README.TXT 3. Custom Attachments for multiple tables: In the above case, I have created the code for the Opportunity Card page. I will repeat the same for Item Card Page. Prior to Items Card Page Make a copy of all the 3 Pages and change their names and Ids. After adding a new set of pages for different tables Change the Table Nos on the comment line //Change the Table Name Here—-OLISTER and //Change the Page Name Here—-OLISTER After changing Table Names After changing Page Names After changing Part Page Names 4. Output: Finally, I got this. Opportunities Attachment Items Attachment Conclusion: Thus, we are successful in creating a generic code template for attachments. Hope this helps!
Share Story :
Displaying D365 CRM Plugin Messages in Canvas Power Apps using Power Automate
Introduction This blog demonstrates one of several ways to display Business Validation Message to be rendered as Errors in Canvas Apps when User Create or Update record in Canvas Power Apps. Scenario Developers need to show Validation Messages thrown by D365 CRM Plugin to be rendered as Errors in Canvas Power Apps where D365 records are created or updated by using Power Automate. Steps Below are steps needed to be followed to display Error Messages. Create variables for Message & MessageType of type String and initialize default value as a successful scenario for record creation in D365 as below Set Variable VarMessageType should run after your CDS Action has failed Set Variables for the Error scenario with below settings MessageType – ‘2’ Message – message attribute of a body for action of CDS Add action Respond to PowerApp or Flow with output as below Set Action Respond to a PowerApp to run after successful or skipped Handle the MessageType return in Save Action button in Power Apps. Note: You can set only 1 Response to a PowerApp action in single Power Automate. Conclusion : Hope above blog gives an option for Error handling in Power Apps for records created using Power Automate.
Share Story :
[SOLVED] Root Web Page is not getting created in D365 Portals
Introduction In this blog, we will look into how to resolve the “Root Web Pages are not getting created in D365 Portal” issue. Whenever we create a new web page in a portal its root web page automatically gets created and this root page renders entity forms, entity list or web form on the portal. In one of our environments, root web pages were not getting created automatically. We followed the steps below to resolve this issue. Steps Navigate to Customizations -> Customize the system => Default solution will open Select SDK message processing steps Change the view to “All” Filter by primary object type begins with “web page” This would show 10 sdk message processing steps, select all and activate these steps. After this root web page will get created successfully.
Share Story :
Adding “Change Password” in Profile Navigation of D365 Portal.
Introduction This blog explains how we can add “Change Password” in the Profile navigation of the D365 Portal. Steps to be followed: Go to Weblink sets 🡪 Profile Navigation Open Profile Navigation record 3. Click on the “Links” tab. Add “+ New Web Link” 4. Add below details in the form Name: Change Password Web Link Set: Profile Navigation Publishing State: Published External URL: <portal url>/en-US/Account/Manage/ChangePassword Display Order: 2 5. Save the record. 6. Now you can see the “Change Password” option in the profile navigation of the portal. NOTE: if you don’t see the changes clear the cache of the portal and check again. – Click on “Change Password” and it will navigate you to the page below. – You can change your password from here.
Share Story :
Save standardized PDF documents from D365 Sales into Microsoft SharePoint Released in Wave 1 2020
Introduction : This Blog will explain about Saving PDF documents directly to SharePoint in a Single Click and this is available for entities listed below only Account Contact Opportunity Lead Quote Order Invoice Steps to enable Entities for PDF generation: Note : Before starting make sure wave 1 2020 feature is enable in Sandbox. Go to Sales hub -> App settings -> and Convert to PDF. 2. Click on Manage -> Enable entities and save. PDF Creation: Once we have enabled entities, “Create PDF” button will be enabled as shown below : 2. When you click on Document , option will be shown to save the document in SharePoint. If we want to save the Document , Click on Save. Else Document will be downloaded. 3. We can view the saved Document by browsing to Related>>Documents in Dynamic CRM. Also we can view the Documents in the SharePoint. Conclusion : This feature will be helpful for Sales Team to increase Productivity.
Share Story :
Customize the business card scanner control
To edit the mappings of Business card scanner control, refer below steps. Select the Settings icon, and then select Advanced Settings. The Business Management page opens. On the navigation bar, select Settings, and then under Customization, select Customization. Select Customize the System. Under Components in the solution explorer, expand Entities, and then expand the Contact or Lead Select Forms. Open the form of type Quick Create. Locate and select the Business Card field on the form, and select Change Properties in the Edit In the Field Properties dialog box, select AI Builder Business Card control on the Control Select the property that you want to change the mapping for, and select the Edit icon to change the value the field maps to. When done, select OK.
Share Story :
Clear DateTime Field using MS Flows
Introduction: We had a requirement, where using MS flows, we had to set the field named Outreach which was a datetime field as blank. For a date time field,null expression cannot be directly set and so we could not clear the existing Date in this field When I tried to set null, it failed with an error “Minimum value for date can be 01/01/1753”. Solution: We used the below work around. Add a step Convert Time Zone, add base time as Null. Since we are not actually converting from any time zone, we can keep source and destination time zone as same. For the record on which we want to set date as null, configure run after as below. For the date, now set converted time instead of null Conclusion: The date will be cleared and set to blank.
Share Story :
Sort on Related Column in a View
Introduction: When we create a view, We can configure the sort but the sorting is available only for the columns which are a part of the entity on which the view is created. Eg: In the active accounts view, there is a column ” Email” which is a field from Contact Entity. If we see the columns available for sorting we cannot see Email. However, in case you want to sort on a column from the related entity we can do it using the view designer and Fetch Xml builder tools from the XRM Toolbox. Solution: On load of My active accounts, the default sort is on Account Name Open View Designer on XRM Toolbox Click on Edit Query to open Fetch XML Builder We can see the order attribute is on name Now, we can edit and add order attribute to emailaddress1 After you click on Return FetchXML, you will return back to view designer. Then click on edit XML and remove the disable sorting on the attribute. You can now save and Publish. Conclusion: The View My active accounts will be by default sorted by email address in ascending order.
Share Story :
Tender-based discounts in Dynamics 365 Commerce(Retail)
Some Retailers may want to encourage customers to pay via cash in their Retail stores. This can be made possible by offering discounts to customers if they pay by a Cash mode of payment. In this way, they can help reduce the expense of credit card processing fees. Therefore, retailers might provide discounts to customers who use these alternative tender types. In Dynamics 365 Commerce (Retail) a new type of discount has been introduced which is called as tender based discount. In tender based discounts, as a Retailer you are able to give different discounts based on the payment medium the customer has chosen to pay. Even though tender-based discounts reduce the subtotal of the transaction, automatic charges that are applied to the transaction aren’t affected. For example, if the delivery charges are calculated as $5 because the subtotal was more than $100, and the tender-based discount reduces the amount so that it’s less than $100, the delivery charges are still $5 for the order. In the system you can go to Retail>Pricing and discounts >Tender discount. Here you can set up the parameter as required, add price groups and then run necessary jobs to apply it in Retail POS. In the below example the payment type selected is Cash. You can select any type of method as per your need.
Share Story :
“You are not authorized to send mail on behalf of the specified sending account.” – Resolved.
Introduction: We had requirement where we wanted to send Email using Power Automate. We had already implemented this using Work Flow. While implementing this using Power Automate, we started receiving mentioned issue “You are not authorized to send mail on behalf of the specified sending account.” We had similar issue while implementing the same using Work Flow, But it did not work for the Ms Flow, after doing RND we came to know that we need to give permission to send the mail on behalf of another user. Solution : Please follow the below steps to give permission to specific user. Step 1: Go to Admin Center -> Select Exchange Admin Center. Step 2: Click on Recipients and Select User you want to give permission and follow the steps as shown below. Step 3: In this scenario, We wanted to send Email from Admin on behalf of Support User. Below are the Steps to Give the Permission: i. Go to mailbox delegation. ii. Click on the “+” icon and add User from which you want to send Email. In this scenario, we wanted to the send Email by Support. So, add Admin into Send as and Send on behalf and Full Access. ->Save and try to run the flow. Hope this will help you while sending an Email on behalf of the another User.
