Category Archives: D365 Business Central
Exporting record details to excel using Excel Buffer in Microsoft Dynamics NAV 2017
Introduction In this article, the selected record details by the user are exported to excel using Excel Buffer. The requirement was such that Purchase Request is sent to the Vendors to enter the Unit cost of each Purchase Items. These details are sent to the vendors in an excel sheet. After the Unit cost is entered the excel sheet is imported again in the Dynamics NAV. Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1.Create a report and Data link between the records. 2. Below is the screenshot of the Data Item Link 3. In the globals (Ctrl+G), define the excel buffer table (no 370) to create excel sheet 4. Define the function MakeExcelDataHeader to create the header of the excel sheet and MakeExcelDataBody for the Body Lines. 5. Create a Boolean variable Print to Excel and insert it in the request page. If true then call the function CreateExcelBook. 6. On the PreDataItem Call the function MakeDataExcelHeader and OnAfterGetRecords call the function MakeDataBody 7. Using Excel Buffer table code as below in the functions 8. In the Page, create an action button to run the report. 9. In the page, select the record and click on the Export to Excel button 10. Click on OK 11. This call the report and fetches the data records in an excel sheet. This sheet is then sent to the vendor to enter the unit cost of the respective item. Conclusion: Thus using excel buffer record we can export records from Microsoft Dynamics NAV to Excel sheets.
Share Story :
Item Charges Setup in Dynamics NAV
One of the most popular and widely accepted ERP systems which is popular in both small and big businesses is the Microsoft dynamics nav integration. The reason for its popularity and wide acceptance is its user-friendly interface and simple installation process. Dynamics NAV customers are missing out on the real benefits of upgrading to Dynamics NAV in today’s cloud-based environment. If you upgrade Dynamics NAV, you will be taking advantage of improved functionality, new features, and enhanced capabilities, you can boost productivity, reduce costs, and improve customer service. Microsoft is continually looking at ways to improvise the Enterprise Resource Planning Systems. Using Microsoft Dynamics NAV Inventory Management, companies can do tasks such as setting up alternative vendors, check on inventory assembly management, and get the required analysis report with ease. Introduction: The item charge functionality in Dynamics NAV gives you the option to include additional costs such as freight, insurance, fuel charges, etc. in the unit cost or unit price of an item transaction. Item charges setup is part of the general Finance setup. Companies can set up different item charge numbers to distinguish types of charges and improve cost and sales statistics. Set up: Path : Financial Management > Inventory > Setup Or Enter “item charges” in the Search box, and then select the related link. Item charge must have a general product posting group and a VAT product posting group. This combination of posting groups determines the general ledger account to which the item charge is posted. Once Item charges has been setup then you can select it on purchase ad sales document line Conclusion : Item charges are an ideal way to record item-related financial transactions without affecting inventory quantities. A company can use item charges in the purchase and sales processes to improve the accuracy of cost and sales information, and contribute to improved decision making.
Share Story :
Procedure to call an External API from Microsoft Dynamics NAV
Introduction: In this article, I will be giving the procedure to call an External API from Microsoft Dynamics NAV. The external API which I am going to call from Microsoft Dynamics NAV is ‘TIBCO Cloud Integration’ as I want to perform real-time integration between Dynamics NAV and Dynamics CRM. Pre-Requisites: 1. Microsoft Dynamics NAV 2. External API which will be called i.e. in this scenario, TIBCO Cloud Integration Mapping. Procedure: JSON syntax will be used for storing and exchanging data from Microsoft Dynamics NAV. I have created the following variables: ‘StringBuilder’ of datatype: DotNet and Subtype: System.Text.StringBuilder.’mscorlib’ ‘StringWriter’ of datatype: DotNet and Subtype: System.IO.StringWriter.’mscorlib’ ‘String Reader’ of datatype: DotNet and Subtype: System.IO.StringReader.’mscorlib’ ‘Json’ of datatype: DotNet and Subtype: System.String.’mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=***’ ‘JsonTextWriter’ of datatype ‘DotNet’ and Subtype: Newtonsoft.Json.JsonTextWriter.’Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=***’ ‘JsonTextReader’ of datatype ‘DotNet’ and subtype: Newtonsoft.Json.JsonTextReader.’Newtonsoft.Json, Version=6.0.0.0, Culture=neutral, PublicKeyToken=***’ I have created a function ‘Initialize’ which upon calling will initialize StringBuilder, StringWriter and JsonTextWriter variables as below: StringBuilder := StringBuilder.StringBuilder; StringWriter := StringWriter.StringWriter(StringBuilder); JsonTextWriter := JsonTextWriter.JsonTextWriter(StringWriter); I have created a function ‘StartJson’ where I am calling the ‘Initialize’ variables function and then calling the ‘WriteStartObject’ of JsonTextWriter DotNet variable. Now create a function ‘AddToJson’ which accepts two parameters as below: The first parameter accepts the name of the Scribe field mapping i.e. name of the External API field mapping. The second parameter is the field value which is passed from Microsoft Dynamics NAV. Create another function ‘EndJson’ and call the ‘WriteEndObject’ as below: JsonTextWriter.WriteEndObject; Create a function ‘GetJson’ where the JSon content is converted ToString. JSon := StringBuilder.ToString; Next I have created a function ‘UploadJSon’ which will upload and POST the parameter values from Dynamics NAV. The UploadJson has the following parameters: The Subtype of DotNet variable ‘String’ is ‘System.String.’mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=***’ WebServiceURL is the URL which will be called, in this case I will be passing the Scribe map URL which will be hit on a particular condition to perform real time integration. I have created two local variables for the UploadJson function as below: ‘HttpWebRequest’ variable of DotNet DataType and SubType : System.Net.HttpWebRequest.’System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=***’ ‘HttpWebResponse’ variable of DotNet DataType and Subtype: System.Net.WebResponse.’System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=***’ The following code is written in the UploadJson function: The CreateWebRequest, SetRequestStream, DoWebRequest and GetResponseStream functions are as below: The CreateWebRequest accepts two parameters from which the second parameter is the HTTP request method i.e. ‘POST’ or ‘GET’. I have used ‘POST’ as this method submits data to be processed by a specified resource. You can set the timeout required during which the External API should be called. Now in my codeunit’s OnRun() function I have written the following code so that the External API URL i.e. Scribe map is hit and the real time integration between NAV and CRM takes place. I am passing five field values from Dynamics NAV. Note: AddToJSon(‘Car_Stage’,CarStageGlobal) where ‘Car_Stage’ is the name of the Scribe field mapping and ‘CarStageGlobal’ is the NAV field value. I have passed the Scribe map URL to UploadJson function and the Json DotNet variable. Conclusion: In this way, an External API can be called from Dynamics NAV. The External API URL i.e. Scribe map URL in this case is hit within seconds and real-time integration is performed quickly. The field values changed in Dynamics NAV are immediately reflected in Dynamics CRM.
Share Story :
To run a batch to check for visa expiry date of employees and send an email if visa expires in a month in Dynamics NAV
Introduction: This article focuses on to creating a batch to run everyday to check for employee’s visa expiry date. If the visa expires in a month an email notification is sent to the HR Manager about the visa expiry of the respective employee. Pre-requisites: Microsoft Dynamics NAV 2017 Steps: Create a new codeunit with id and name. Set up the SMTP mail setup in NAV. 3. In the Globals (Ctrl+G),create a record for employee table. 4. Create a function and call it on run. 5. Here in the above code calculate the previous months date of the visa expiry date and if the the date is today then an email is send using smtp mail 6. Create a job queue to run every day. Set the start time and end time. 7. An email is sent if today’s date is the previous month date of visa expiry.
Share Story :
Smart Notifications in NAV 2017
Partially built using the Notifications in the UI the smart notifications gives you advice when you use the application. As an example; if you create a new sales invoice for a customer that have an overdue balance you will see the below notification. Another example is when you close a sales order you receive a message saying that the order has not been posted (I am a bit skeptical to this one since in my world posting a sales order is not done by the same person that’s entering it). Luckily this is configurable and each user can turn the features off and on through the My Notifications setup where conditions also can be applied. I think this is a cool concept and I see a potential to create custom notifications to support how the business wants to operate and to reduce common user mistakes.
Share Story :
Export data to Excel in Dynamics NAV with Column captions using XML port
Introduction: With the help of XML port, it is possible to import and export data in Dynamics NAV. While exporting data to an Excel sheet, we always have a requirement to export data along with the column captions to an excel sheet. In this blog article, I will be explaining the procedure to achieve the same. Pre-requisite: Microsoft Dynamics NAV 2017 Procedure: Enter a node name. I have entered my node name as ‘Root’ with Node Type as ‘Element’ and Source Type as ‘Text’. For the caption names, first create a node with Node Type as ‘Element’ and Source Type as ‘Table’. Enter the Data Source as ‘Integer’ which is a virtual table in Dynamics NAV. Now enter a node name for your first caption name. In this example, I have entered ‘VINTitle’ as my first column caption name with Node Type as ‘Element’ and Source Type as ‘Text’. Go to C/AL code of ‘VINTitle’ which is my first node name and in ‘OnBeforePassVariable()’ write the code for the caption name that should appear in the Excel sheet when data is exported.This will display the name of the field which is entered in the table or you can also manually assign the name of the caption that should appear in the Excel sheet after exporting data as shown below. After the caption name is mentioned, now you have to enter the value which should be fetched from the table and appear in the Excel sheet. Enter the node name for your table with ‘Node Type’ as ‘Element’ and Source Type as ‘Table’. Enter your Data source. In this I have taken ‘Item’ as my Data source and the field ‘No.’ of Item table. Conclusion: After exporting data to an Excel sheet, the column captions appear in it along with the values of the column.
Share Story :
Creation of a new Role Center and assigning it to a user as a profile in Microsoft Dynamics Nav 2017
Introduction: This article focuses on how to create a Role center page and assign the role to a user as a user profile. The requirement was such that the user needs a Role center for the HR where the HR can view the Active, Inactive and Terminated employees and can also view the List of employees, Leave application list etc. Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1. Create a query with Data Source as Employee Table, create a filter field Status, here status is a option field which has three options -Active, Inative and Terminated.Create a column field and set Method type as Totals and Method as Count. 2. Create a table with name e.g. HR Cue table. Here set the fields FieldClass to Flowfield and CalcFormula to Count. 3. Create a global function CountOrders and define the query in the variables. Here in the function, depending on the field number selected, it calls the query and sets the status to it. 4. To display Cues on the Role centre, we need to create a Page with Group subtype as CueGroup. 5. Use CueSetup codeunit for setting up cues and create an action Setup Cues. Create a local function CalculateCueFieldValues which checks if the field is active then it calls the global function CountOrders of HR Cue Page. 6. Create a Control Action as New Employee and set RunPageMode to Create and Run Object to Page Employee card. On running the cue Page 7. Create a new page for the Role Center with container subtype RoleCenterArea. 8. In Action Container subtype create HomeItems and add Action List. 9. In the Windows client, create a new Profile HR 10. Browse to the User personalization in the search bar in windows client , select the user HR and assign the HR Profile to it. 11. Log in to the Windows client/Web client.
Share Story :
Dynamics Column reports in Navision 2017
Introduction: Many of client required report with dynamics Column in Navision. We all know dynamics data is displaying top to bottom. But what happen if customer want data left to right. And As data increase Column also increase in the report. In this blog, I will show you Item inventory report, where Item will display in row and location will display in Column. But when you add any new location in Navision and Post any Item Journal, sales, purchase entry for that location, that new location will added in report Column. Steps 1: Open Navision Development Environment. Go to Object Designer. And Create New Reports. For Demo I created New Report “ Item By Location New “ report ID 50029. Steps 2: GO to Design mode of that report. Take Item table in Data Item and Item Ledger Entry table in 2nd data Item. Relation set DataItemLink “Item No.=FIELD(No.)” in Item Ledger entry Property. Select the Column from the table. For the demo, I have taken only 4 fields, you can as fields as you’re your requirements. Steps 3: Go to view and and select Layout option. Here I am using SSRS Report Builder. Click on Insert , then click on Table button and select Table Wizard Option. And select 1st option as per screen shots. Step 4: In Column groups click and drag Location code , for Row Group Item No. and in Value Sum of Quantity. Click on next and finish. Steps 5: Now add Item description fields on right side of Item. Step 6: Save the report and run. Click on preview. Steps 7 : Create new location and post Positive adjustment entry for that New location and again preview the report. New location is added in that report and its inventory Update. Conclusion :- With this method you can create dynamics column reports, which can be print left to right column.
Share Story :
To restrict an action button to a particular user in NAV 2017
Introduction: This article focuses on how to restrict other users and allow only a particular user to user a specified action button in a Page in NAV 2017. The requirement was such that the page Purchase quote is to be signed off by the CEO and then Purchase order is created. Here, an action button is created called Sign off, where on click of the button, the boolean field called Sign off which is an un-editable field is enabled. Only the CEO should have the access to Sign off the Purchase Quote. The other users should be restricted from signing off the Purchase Quote Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1. In the NAV Development Environment, create a Boolean field. e.g CEO in the User Setup table. 2. Add this field to the User setup page and enable this field for the CEO user. 3. Create a button Sign off in the purchase quote. Create a new codeunit and subscribe it to the action button Sign off. 4. Create a global variable User Setup in the codeunit and refer the below code. 5. In the Windows client/Web Client, browse to Purchase Quote from the search bar. 6. Edit any Purchase Quote and click on Sign off. Here if the User is not the CEO, in the above image the user is OETIADMIN ,a message is displayed ‘Only the CEO can Sign off this purchase document’ 7. If the User is the authorize user to sign off in this case the CEO then the message is displayed as Purchase Quote is signed off.
Share Story :
Set up Single Sign-on in Dynamics NAV with Office 365 using Windows PowerShell
Microsoft Dynamics Nav integration is a default integration setup for Dynamics Nav that gives an option to integrate and use Microsoft Dynamics CRM entities with itself. The only thing that needs to be done for the integration is to enable the default integration setup after which you are good to go. After the successful integration, the user is able to integrate accounts, contacts, products, user, transaction currency, Sales Order which are synchronise data of Microsoft Dynamics CRM with the customers, contacts, items, Salesperson, Currency, Sales Order and Unit of measure which are the entities of Microsoft Dynamics Nav. This integration or linking of the records eases the process on many levels giving the customer a hassle free transaction and complex free system Introduction: Single sign-on (SSO) in Dynamics NAV is a process which authenticates a user to access NAV Web client and NAV windows client using Office 365 email login credentials. When a new Office 365 subscription is provisioned, the Azure AD tenant for this subscription has to be created. Pre-Requisites Microsoft Azure Active Directory Module for Windows PowerShell Microsoft Online Services Sign-in Assistant You can download the setup of Microsoft Online Services Sign-in Assistant from here Microsoft Dynamics NAV 2017 Purpose In this article, I will be explaining the procedure to configure Single Sign-on in Dynamics NAV with the Office 365 login credentials of a user using Windows PowerShell. Procedure: Go to Microsoft Dynamics NAV 2017 Administration and in the NAV instance enter the Certificate Thumbprint (the certificate can be either an SSL certificate or a self-signed certificate) Save the changes and restart your NAV instance. Go to mmc.exe and navigate to the certificate that is being used for Single sign-on. In mmc.exe, in Personal certificates section, in ‘Manage private keys’, add ‘NETWORK SERVICE’ as a user name and grant full control permissions to ‘NETWORK SERVICE’ user. In mmc.exe, along with Personal certificates section make sure the certificate is present in trusted root certification, Enterprise trust, Trusted publishers and Trusted people. Navigate to the user for which Single sign-on is being set up in NAV and under Office 365 Authentication enter the Office 365 email of the user. Now run Microsoft Azure Active Directory Module for Windows PowerShell as administrator. Navigate to the Service folder to find NavAdminTool.ps1 module and run the following command in PowerShell to import the module Import-Module “C:\Program Files\Microsoft Dynamics NAV\100\Service\NavAdminTool.ps1” Navigate to the RoleTailoredClient folder to find ps1 module and run the following command in PowerShell to import the module. Import-Module “C:\Program Files (x86)\Microsoft Dynamics NAV\100\RoleTailored Client\NavModelTools.ps1” To import NAVOffice365Administration Module, navigate to the Microsoft Dynamics NAV DVD and then to NAVOffice365Administration. Run the following command in PowerShell to import NAVOffice365Administration.psm1. Import-Module “C:\Users\iotapadmin\Documents\CU 5 NAV 2017 W1\NAV.10.0.16177.W1.DVD\WindowsPowerShellScripts\NAVOffice365Administration\NAVOffice365Administration.psm1” To configure your Microsoft Dynamics NAV Server for single sign-on, you have to run the cmdlet Set-NavSingleSignOnWithOffice365 in PowerShell with the following parameter set: Set-NavSingleSignOnWithOffice365 -AuthenticationEmail “YourAuthenticationEmail” -NavServerInstance “YourNAVServerInstance” -NavUser “YourNavUser” -NavWebAddress “YourNavWebClientAddress” -NavServerCertificateThumbprint “YourNAVServerCertificateThumbprint” -NavWebServerInstanceName “YourNavWebServerInstanceName” After entering this command a pop up box shown as below appears with the Office 365 email ID given in the above command and you have to enter the password of the given Office 365 email ID: After entering the password, the below output will appear in PowerShell: Copy and save the URL that appears at the end in PowerShell as it will be required later. Navigate to the ClientUserSettings file of the user and change the following parameters:Change ClientServicesCredentialType parameter value from ‘Windows’ to ‘AccessControlService’. Change the ACSUri parameter value to the value of URL link generated after the PowerShell command runs which I have mentioned in step 8. The parameters of the web client web.config file have not to be modified manually. It is automatically modified after the PowerShell command script runs. After SSO is configured, when you start Dynamics NAV Windows client and Web client, you have to enter the credentials of the Office 365 email ID which is provided while running PowerShell script in step 8. Fig: Windows Client Fig: Web Client