Generate Hash Value and Integrate Form Data Third-Party System using API Object.
Problem Statement: Every document that goes out or comes into Business Central requires some kinda validation to check its originality which confirms the confidentiality of the document. Introduction: This blog is a two-step process in which I will be explaining how things work and how to write a code for this. This blog also is an update on Hannes Holst Blog(https://www.hannesholst.com/blog/technology/hash-hash-baby-secure-hash-algorithm-in-nav-365bc-and-a-little-more/) and you don’t need to access any .NET variable. Pre-requisites: Microsoft Dynamics Business Central VS Code AL Language Understanding of how data is transferred using API Books & References: https://docs.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/httpcontent/httpcontent-data-type https://www.hannesholst.com/blog/technology/hash-hash-baby-secure-hash-algorithm-in-nav-365bc-and-a-little-more/ https://www.yammer.com/dynamicsnavdev/threads/465800571707392 Demonstration: 1. Creating a Hash Value: Whenever a file is Uploaded to Business Central Document Attachment Table, Business Central should auto-calculate its Hash value. The Hash Algorithm will be selected on a setup. Creating a Local Hash Value field in the Document Attachment Table. Document Attachment Table Extension Hash generated by Business Central Create a set of the field on Setup Table where you will be selecting the Hash Algorithm. API Setup for Trokt App Calculating Hash Value using the Cryptography Management Codeunit. Thanks to Natalie(https://www.yammer.com/dynamicsnavdev/threads/465800571707392), who pointed me in the right direction. Creating HASH Value from File After the computation of Hash Value, the Third – Party Tool API should be triggered with a parameter as the Hash Value. 2. Integrating API with Third-Party Tool: When API has triggered with the Hash Value as a form data, the Third-Party Tools recognizes the Hash Value and then auto-computes other parameters and returns their unique value. API Call with Form – Data payload and storing response This unique value is going to be stored in the Business Central Document Attachment Table. Attaching File and getting TROKT HASH in Document Attachment Table Checking the API Data through POSTMAN passing the HASH Value as a Filtering Parameter Checking if HASH Value was passed to TROKT API Conclusion: Overall, this was the journey as a trial and error process for one of my clients Proof of Concept. I’m really happy with how perfectly it turned out to be.
Share Story :
How to get Preview Version of Business Central
Introduction: With Business Central now progressing it’s way in the market, Microsoft will be releasing seamless upgrades every 6 months i.e April(Wave 1) and October (Wave 2). Thus, this means that with each wave there are going to be public preview coming up for the customers to get few insights as to what all is expected. Pre-requisites: Microsoft Dynamics 365 Business Central. Books & References: https://docs.microsoft.com/en-in/dynamics365/get-started/release-schedule https://freddysblog.com/2019/07/31/preview-of-dynamics-365-business-central-2019-release-wave-2/ Demonstration: There are two ways to get Microsoft Dynamics 365 Business Central Public Preview 1. Create a new Sandbox: In the Admin Center for Business Central, you can create a new Sandbox with preview Signing Up Business Central Sandbox for Version 16 Public Preview Microsoft Dynamics 365 Business Central Wave 1 2020(V16) on Sandbox 2. Create a Docker Container: Referring to https://freddysblog.com/2019/07/31/preview-of-dynamics-365-business-central-2019-release-wave-2/I had noticed that when you are creating a docker container using BC INSIDER, you will get a the latest version of Business Central Docker Container. Microsoft Dynamics Business Central Wave 1 2020(V16) Container Setup Business Central Login Business Central Wave 1 2020 (Version 16) Container Sandbox Note: For you to get access to BCINSIDER, you will need access to Microsoft Collaborate. There inside the packages, you will find the text file which will contain the access credentials to BCINSIDER container image. Conclusion: I hope this blog helped in anyway setting up public preview in Microsoft Dynamics Business Central. In my upcoming blogs, I will also showcase how we can setup public preview in Microsoft Dynamics 365 Business Application.
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 :
Select and Email Multiple attachments from a list of Documents
Problem Statement: I have a requirement where the user will select multiple attachments of choice from a list of Documents and Email them. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics Business Central Solution: Step 1: Create a drill-down on the field where the user will select attachments from a list of Documents. Here we have used Page Document Attachment Details as a drill-down page where I have attached some documents. Drill Down In the above code, I have created a drill-down of page Document Attachment Details. SetSelectionFilter() – To get selected attachments from the list of Documents. Step 2: Here I have created Instream and Outstream Objects for Attachments as shown below: In the below code Rec_Sample is a Record variable for sample table which contains the Media field “Document Reference” which stores the unique Document Reference ID of a single Document. After that, the same document is exported and Imported using Exportstream and Importstream. And AddAttachmentStream is called with the Instream object to add the attachment. This is done for the number of attachments selected and then the mail is sent. Conclusion: This way we can send Multiple attachments selected by the user and email them. Hope this helps!
Share Story :
How to use LinkedObject property
Introduction: There can be a case where developers might need to display data from different companies in NAV or Unique view of Tables displaying unique values of a table or Joins from Tables. In such cases, developers can use the “LinkedObject” property of a table. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics NAV Solution: Step 1: Go to SQL Server Management Studio and create a view of the table from where you want to display field values. Here I have created a view of Customer Table to display distinct Customer Names. And saved the view as “AdityaCustomer” Company Name as the prefix. View Step 2: Now, In NAV Development Environment create a table with the same as the view that has been created, Do not include the company prefix. And add the field with the same name of the field included in View. Table in NAV Linked Object Property Step 3: When this Table is run, you can see distinct Customer names in the Table. Conclusion: This way developers can display data from Views using LinkeObject property. Hope this helps!
Share Story :
Schedule Serverless CRON Job to Pull data from REST APIs (Part – 1)
REST API is an Application Program Interface that uses HTTP request to GET, PUT, POST and DELETE data, it’s an architecture style approach to communicate with third party application. In order to integrate our module with third party applications or in order to pull data from third party application to our database for analysis purpose the REST APIs are useful. For the analysis purpose we can consume REST API with SSIS using third party connector, but the problem with this approach is that, it will be required On Premise server for package deployment and job schedule. The alternate approach is to use serverless CRON expression. Since, mid 2018 the serverless development methodology is ditching the traditional development. In this blog we are going to see how to consume REST API with Serverless CRON expression. Here, we are using Zoho People API for integrating HR modules data to Azure DB. With Zoho People API, you can extract employee’s data and form data in XML or JSON format to develop new applications or integrate with your existing business applications. Zoho People API is independent of programming languages which helps you to develop applications in any programming languages (reference). Implementation Authentication token generation In order to access Zoho People API, Zoho People authentication token is required. The token can be generated using Browser mode and API mode. For the API mode each request has Username or Email and Password needs to include in the POST body Another approach is to register your app with Zoho by going to zoho.com/developerconsole and Add Client ID, Once added it can be used to generate new access_token. We can check the response by use using POST request, Open any REST Client and send request by using any REST API method, here we are send request to get leave data and we are using VS Code REST Client. If the request is valid then the we can get response in following format containing the data requested. 3. As we are getting proper response, the next step is to create CRON expression (Serverless approach) to pull the data from REST API, here we are going to use App services on Azure to create Timer Trigger Function App. The CRON expression is a time-based job schedular. which has six field to define time precision in following format. {second} {minute} {hour} {day} {month} {day-of-week} Each field can have one of the following types of values: Type Example When triggered A specific value “0 5 * * * *” at hh:05:00 where hh is every hour (once an hour) All values (*) “0 * 5 * * *” at 5:mm:00 every day, where mm is every minute of the hour (60 times a day) A range (- operator) “5-7 * * * * *” at hh:mm:05, hh:mm:06, and hh:mm:07 where hh:mm is every minute of every hour (3 times a minute) A set of values (, operator) “5,8,10 * * * * *” at hh:mm:05, hh:mm:08, and hh:mm:10 where hh:mm is every minute of every hour (3 times a minute) An interval value (/ operator) “0 */5 * * * *” at hh:05:00, hh:10:00, hh:15:00, and so on through hh:55:00 where hh is every hour (12 times an hour) 4. The next step is to create function app, for development purpose we are going to use Visual Studio Community 2019/2017. In Visual Studio create a project by selecting File > New > Project Select Visual C# (here we are going to use C# for development you can choose Php, Python or F#) any of your choice. Under the Visual C# select the Azure Functions and click on Next The next step is select a new Azure Function Application, Select the Timer trigger function choose your Azure Function version (v1, v2 or v3). Select Authorization level as Anonymous as we don’t want to include API Key for the function and kept the other settings as it is. After clicking on Create button, it will create the Azure Function App Solution for us, the directory structure is as follow. The next step is to publish the function on Azure, it will deploy your function on IIS and Azure. That we will see in next part of this blog.
Share Story :
Schedule Serverless CRON Job to Pull data from REST APIs (Part – 2)
In this blog we’ll see how t publish the and deploy the Azure function on App service. With Continuing with the previous part of this blog Right Click on the solution and click on Publish, it will ask to select the proper subscription, resource group. Select the option relevant to you. Following are the Publishing option available for us. Publish on Azure App Service Azure Virtual Machines File system Local webserver (IIS) Note:- Make sure you have sign in with proper credential and cloud explorer is connected. Once we publish the function, we can check Azure function by going to the https://portal.azure.com/ then search for the Function App. We can see our function app in read only mode, since we have deployed it from visual studio environment. The next step is to create the development logic for the data pull from the Zoho People. Make sure to add all reference libraries required for the development, we can manage the NuGet package manager by going Right clicking on the solution and select manage NuGet package. Make sure to add all required reference to your script file. using System; using Microsoft.Azure.WebJobs; using Microsoft.Extensions.Logging; using Newtonsoft.Json; using System.Data.SqlClient; using System.Net.Http; using System.Net.Http.Headers; using System.Collections.Generic; using System.Linq; As our destination is Azure DB so, we need to create the environment variable to store ADO.NET connection string in settings.json file or by clicking on Azure App Service Settings Then click on Add Setting and then add the setting name like in following diagram we are creating setting for the Azure DB connection. Click on ok and provide the value for the setting. We can get azure connection string by going to the Azure Portal search the DB name and then click on the connection string and copy the ADO.NET connection string, replace the {your_password} with your server password. After adding the environment variable, we can check this in settings.json file The Next step is to implement the code logic and debug the code on local. That we’ll see in final part of this blog.
Share Story :
Schedule Serverless CRON Job to Pull data from REST APIs (Part – 3)
In this part we’ll see how to Debug the code on local. Once we done with the configuration settings the next step is to call the REST API in our code, here we are using C# for the development. Once we done with the code logic, we can run the code on local by adding the breakpoint The Azure Function app will launch in a local Functions host, and your trigger will be available locally on http://localhost:7071/api/Function1 default listening port is 7071, we can also change the port number by going to the project setting and setting Application arguments to the project settings. host start –pause-on-error –port 7079 We can also launch multiple apps at the same time, we can do this by adding multiple breakpoint at the same time and then start the function without debugging and start another function through debugger and attached the debugger to function app by, Select Debug > Attach to process. Search for fun The greyed-out function is in running state and other is running through debugger. Select the other and click Attach and then we can open the browser and run the both function app different port gets assigned to each function. Publish the App on the Azure and make sure to add the all the parameters on the configuration by going to the Configuration on the Function App. Note:- For every changes on app we need to build and publish the app.
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 :
Extend a User-Created Table
Introduction: Microsoft Dynamics Business Central allows extending Pre-defined Tables, which is basically Customization and it is achieved using Extensions. Using Extensions developers can modify Pre-defined Tables according to requirements. But the extension of a Table can be done only if its “Extensible” property is set as True. This property is by default set as True for Tables. Now suppose a developer wants to extend a table that is created. Pre-requisites: VS Code AL Language Extension Microsoft Dynamics Business Central Solution: Step 1: Set the Extensible property of the Table that is supposed to be extended as shown below: In this case, the table to be extended is “Properties”. Extensible Property Step 2: Now go to Extension Management and get the AppID, Publisher, Name of App and Version as shown below: App Details Put the above details of App in the dependencies section of the new extension where the table is to be extended as shown below and download symbols: Dependencies Step 3: You can see that the “Properties” table is now available for extension. Here I have added a field “Extended Name” in the Properties Table. Also, that field can now be seen by accessing Properties Table by URL. Extended Table Thank you. Hope this helps!
