D365 Business Central Archives - Page 29 of 33 - - Page 29

Category Archives: D365 Business Central

Procedure to repeat table header rows on every page of a report in Dynamics NAV

Introduction: In reports, we always a requirement to display header rows of the table on every page. In this article, I will be explaining the steps to do the same in Dynamics NAV. Pre-Requisite: 1. Microsoft Dynamics NAV 2. Visual Studio Report design Environment Procedure: 1. Under layout of your report, click on the arrow under Column groups and then click on Advanced Mode. 2. Now click on (Static) under Row Groups section. 3. Navigate to the properties window of the (Static) under row groups which is displayed on the right. If it is not present, you can open it by navigating to View->Properties Windows or using ‘F4’ button. The properties window will then appear on the right. 4. Now, you need to modify the following properties. Set ‘FixedDate’ property to ‘True’. Set ‘KeepWithGroup’ property to ‘After’. Set ‘RepeatOnNewPage’ property to ‘True’. Using the above steps, your table header rows will be displayed on every page of your report. In the above screenshot, my table header row which includes the captions for the column i.e. row containing ‘No’ and ‘Name’ will be displayed on every page of the report.  

Share Story :

Dynamically hide and show fields according to a specific condition on a page in Dynamics NAV

If you have a small or a mid-sized business and still running an older version, you must seriously think of Microsoft dynamics nav upgrade. Microsoft is consistently seeing approaches to ad lib the Enterprise Resource Planning Systems or ERPs. Utilizing Microsoft Dynamics NAV Inventory Management, organizations can do undertakings, for example, setting up elective sellers, beware of stock gathering the board, and get the necessary examination report effortlessly.  70 percent of Microsoft Dynamics NAV clients around the globe keep on running old variants of NAV. Albeit past NAV forms have conveyed ground-breaking operational advantages all through its use, moving up to the most recent adaptation takes execution, spryness and interoperability to unheard of levels. One of the prime explanations behind not overhauling is the hesitance.  Introduction: We often have a requirement to dynamically hide or show fields on a page according to a certain condition. Setting visibility properties of the fields to ‘True’ or ‘False’ do not help as they do not work dynamically. They are only set when the page is opened initially. In this article, I will be demonstrating the procedure to show or hide fields dynamically on a page according to a specific condition. Pre-Requisite: Microsoft Dynamics NAV 2017 Procedure: This is the scenario that I was customizing. I was working on two types of contracts i.e. Rental and Lease contracts. The user has to select the contract type on the page. Now if the user selects ‘Rental Contract’ as the Contract Type then a certain set of fields should be visible to the user else, they should be hidden. The first step is to put all the fields that should be shown or hidden dynamically in a separate group on the page. In the above screenshot, I have put all the fields that should be shown or hidden dynamically when ‘Rental Contract’ is selected in ‘Contract Type’ field which is an option field consisting of OptionString ‘Rental Contract and Lease Contracts for Uber and Non-Uber drivers’ under ‘Rental details’ group. Next, go to the properties of the group that contains the fields which should be dynamically hidden or shown i.e. properties of ‘Rental details’ group. Now in the visible property section, define the condition that triggers the fields to be dynamically shown or hidden. So, I have set the condition that when ‘Contract Type’ equals ‘Rental Contract’ then only ‘Rental details’ group should be visible i.e. I have written the condition as below:  “Contract Type”=”Contract Type”::”Rental Contract” Below are the screenshots of my page: The above shows the three options available for contract type. So if Contract type ‘Lease contract for Non-Uber drivers’ or ‘Lease contract for Uber drivers’ is selected then the ‘Rental details’ group along the fields it contains are hidden. The above screenshot shows that only if ‘Rental Contract’ is selected as ‘Contract Type’, only then the Rental details group and the fields it contains becomes visible.

Share Story :

NAV Error: “Resource not found” in TIBCO Cloud Integration

Introduction: In this article, we will see how to resolve the below error while creating/quering records from NAV. Error Details: Error in calling Operation Query (Lookup Block): Operation failed. Label: Lookup CFSCar, Name: CFSCarLookup, Message: The following error has occurred in the Dynamics NAV Connector: Error: NotFound status code = 404. Resource not found for the segment ‘CFSCar’. Scenario: We have a scenario where we are building Integration Process between Microsoft Dynamics 365 (CRM) and NAV 2017. For NAV entities to be visible in Scribe Online, we have to create a Web Service in NAV for that entity. For more Information, you can check our blog article here. So, we had created a Web Service for Item entity i.e. here Items are Car details so the name ‘CFSCar’ in NAV. The ‘CFSCar’ Entity was visible in Scribe Online. But, recently we were getting “Resource not found” error for ‘CFSCar’ entity. So, we Reset the metadata for NAV connection in Scribe and the entity ‘CFSCar’ was not visible anymore. Troubleshooting: We checked the OData URL for entity ‘CFSCar’. We were getting the below error. Reading the above error, we couldn’t pin point the exact error, so we checked the SOAP Url as well. In the SOAP URL for ‘CFSCar’ entity, proper error was displayed. Error details: Naming Conflict within the “Car Status” object. Fields “Rental/Ops Hold” and Rental / Ops Hold” are both transferred to “Rental_Ops_Hold”. Please find new a name for one of those fields! Turns out there was two Status of same name which was causing an issue. Solution: Once we deleted the duplicate status the error was resolved.

Share Story :

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 :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange