Blog Archives - Page 70 of 169 - - Page 70

Category Archives: Blog

Checkout how Download Source Code feature on Extensions in Business Central Version 15 Production helps customers.

Problem: A friend of mine was looking to migrate their Business Central development and support from one partner to another. While, asking me for advice, I was evaluating what was the best solution knowing that their Business Central had customization installed and I found this which made it easy for them as their going to continue customizing Business Central from another partner. Solution: In Business Central version 14 Sandbox, you are allowed to Download Source Code. But in Business Central version 14 Production, this was not the case. No Apps. could have been downloaded even though you got it developed from a Partner/ Developer and installed from them.In Business Central version 15 Sandbox, you are allowed to Download Source Code just like you would in Business Central Version 14 Sandbox. Download Source Code for Installed Extensions in Business Central V15 Sandbox And this is also the same condition  for Business Central version 15 Production tenant as well. Download Source Code for Installed Extensions in Business Central V15 Production Without this, the possible solution to get your app source code back from Production, you would be required to make a copy of Production into Sandbox and download it from there in Business Central Version 14. Note: This doesn’t apply to apps installed through MarketPlace.  Trust me I have tried 😜!!! Conclusion: When App was installed in Business Central Version 14 Production ensured Partners / Developers that app couldn’t be reused on other tenants. This put most of the pressure on the Customers to explicitly to ask the Vendor to provide the App File. Whereas when an App is installed on Business Central Version 15 Production, it can be downloaded and installed in another Business Central Tenants. This means that if the Customers want to change their partners, they can seamlessly do this without having the awkward conversation of asking the code from their previous partner.

Share Story :

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 :

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

Posted On February 22, 2020 by Admin Posted in

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 :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange