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

Category Archives: D365 Business Central

Filtering the temporary table during the run time and adding temporary table records in Report.

Posted On September 3, 2018 by Olister Rumao Posted in Tagged in

Introduction: In Customer Applied Entries there are Payments applied to List of Invoices .Both Payment and Invoices are from Customer Ledger Entry Table .The Payment type entries can be obtained by filtering Document Type = ‘Payment’. Inorder to find the Invoices Applied there are no specific filters that can be applied during compile time and entry list is stored in temporary record variable. And Temporary Record variables cannot be used as DataItem, the list of applied Invoices cannot be displayed in SSRS Report. Pre-requisite: Microsoft Dynamics NAV 2017 Solution: 1. Using the Codeunit 10202 Entry Mgmt, gives the list of applied  Invoices to a specific Payment. 2. List of Variables Note: AppliedCLE is a temporary record variable 3. Creating DataItem as Integer and adding temporary record(Applied CLE) fields in the Integer DataItem  4. Linking between Integer DataItem and AppliedCLE temporary record variable Thus the count of AppliedCLE records is obtained and used to loop the Integer DataItem. 5. Verifying the output i. Using Applied Customer Entries ii. Using the created report Conclusion: DataItems can be virtual tables. These virtual tables can be used to deal with many runtime table filtering scenarios.

Share Story :

Microsoft Dynamics NAV 2017 Error: “The record already exists”

Issue: While trying to integrate records from SFDC to Dynamics NAV 2017, I faced an issue in Scribe saying “The record already exists.”. When I checked in Dynamics NAV 2017, there were no records similar to the one I was trying to integrate when the error occurred. Additionally, when I tried to create a new record in NAV, I got the same error if I filled some other field before filling out the ‘Name’ field. Solution: After some trial and error, I found that this error gets triggered when there is a record not having a value for ‘No.’ which is the Primary Key. Once I deleted this record, creating new records in NAV was no longer an issue for Scribe.

Share Story :

Applying Pivot Table in Excel using Automation Server Objects in NAV

Introduction: In NAV when building a custom report that deals with  totalling the amount by multiple G/L accounts by week then the report becomes tough to read as well as develop  in standard SSRS Report. A possible and easy workaround is dumping all the entries in the Excel and performing the pivot table operation on the entries to give a precise results. Pre-requisite: Microsoft Dynamics NAV 2017 Demonstration: 1. List of Variables: 2. UpdateRange  function to automatically update the sheet range of the current row: 3. Creation of Excel Entries Sheet: Creation of Excel Sheet: Creation of Column Titles: Insertion of Data Entries: 4. Pivoting the Data from the sheet containing entries: Pivoting operation in Excel takes place with the help of Pivot Cache. This Cache is modified using the Automation Variable. Conclusion: The method of using Automation Variable is allowed in On-Prem version of NAV, as it uses Excel libraries that already installed with Microsoft Office. Although this method works perfectly fine Windows Client, it does not work on WebClient. Thanks for reading!!

Share Story :

Microsoft Dynamics 365 Business Central and Microsoft Dynamics 365 for Sales Integration

Introduction: If you use Microsoft Dynamics 365 for Sales for customer engagement then you can use Microsoft Dynamics 365 Business Central for order processing and finances and have seamless integration in the lead-to-cash process. When you integrate you application with sales, you can have all the access to Sales data from Business Central and the other way around in some cases. Thus, Integration enables you to work with and synchronize data types that are common to both services, such as customers, contacts, and sales information, and keep the data up to date in both locations. Pre-requisites: Microsoft Dynamics 365 Business Central Microsoft Dynamics 365 for Sales Demonstration: Steps for Integration: 1. Business Central and Microsoft Dynamics 365 Setup Go to Business Central, in the Setup and Extensions select Assisted Setup. Select Set up Dynamics 365 for Sales Connection for establishing a connection between Business Central and Sales in Microsoft Dynamics 365. In the textbox, Insert the link of the Microsoft Dynamics 365 Sales. Click on Next and insert the Email and Password for the user that will be used for Synchronization between Business Central and Microsoft Dynamics 365 Sales. Click on Finish. Then insert the credentials of the user account which must be used to import the solution. The user account must have Security Roles of System Administrator and Solution .   2. Couple Business Central Salespeople to Microsoft Dynamics 365 User Before a customer can be synchronized to an account, the salesperson that is assigned to the customer must be coupled to a user in Sales. Go to that Salesperson and in navigate select Coupling. A coupling provides the basis for integrating records in Microsoft Dynamics 365 with records in Business Central. Essentially a coupling associates or links a Microsoft Dynamics 365 record to a Business Central record. Hence, coupling needs to be setup for integration. Select the CRM user you want to synchronize the Salesperson with and click on OK. If you want to synchronize data in the account in Microsoft Dynamics 365 and the customer in Business Central, set the Synchronize After Coupling field to one of the following options. Yes – Use the Business Central Data : Copies the data from mapped fields of the customer in Business Central to the account in Microsoft Dynamics 365. Yes – Use the Dynamics 365 Sales for Data: Copies the data from mapped fields of the account in Microsoft Dynamics 365 to the customer in Business Central. 3. Couple Business Central customers to Microsoft Dynamics 365 In the Customer table of Business Central, select the customer you want to couple with Account in Microsoft Dynamics 365 Sales. Set the Coupling of the Customer with the related Account in Microsoft Dynamics 365 and click on OK. 4. Couple Business Central Unit of Measures to Microsoft Dynamics 365 Units Groups In the Unit of Measure table of Business Central, select the Unit of Measure you want to couple with the Unit Group in Microsoft Dynamics 365 Sales. Set the Coupling of the Measure with the related Unit Group in Microsoft Dynamics 365 and click on OK. 5. Couple Business Central Currencies with Microsoft Dynamics 365 transaction Currency In the Currencies table of Business Central, select the Currency you want to couple with the Transaction Currency in Microsoft Dynamics 365 Sales. Set the Coupling of the Currency with the related Transaction Currencies in Microsoft Dynamics 365 and click on OK. 6. Couple Business Central items to Microsoft Dynamics 365 products In the Items table of Business Central, select the item you want to couple with the Product in Microsoft Dynamics 365 Sales. Set the Coupling of that item related to the Product in Microsoft Dynamics 365 and click on OK. 7. Sales Order Integration Create a Sales Order in Microsoft Dynamics 365 and when submitted it appears in Business Central. After submitting sales order, in the search box of Business Central enter Sales Orders, and then choose the related link. In the Sales Orders window, on the Navigate tab, in the Dynamics 365 for Sales group, choose Sales Order List. The Microsoft Dynamics 365 Sales Orders windows opens to display a list of only sales orders in Microsoft Dynamics 365 that have their status as Submitted. Select the Create in Central Business Action to get the Sales Order in Business Central. 8. Sales Invoice Integration On selecting the post action, a posted invoice is generated in Business Central and the status of the Order changes from Submitted to Invoiced. Status changed to Invoiced. In the Posted Sales Invoice window of Business Central, on the Navigate tab, in the Dynamics 365 Sales group,choose  Create Invoice in Dynamics 365 for Sales. Go to Microsoft Dynamics 365 check the Invoices. Conclusion: Thus, we have integrated Microsoft Dynamics 365 Business Central and Microsoft Dynamics 365 for Sales. The table below indicates the direction of mapping of different Data Types. Sr No. Business Central Entity Mapping Direction D365 Entity Default Filter 1 Salespeople/Purchaser Sales -> Business Central User Sales contact filter:  Status is No, User Licensed is Yes, Integration user mode is No 2 Customer Business Central -> Sales and Sales -> Business Central Accounts Sales account filter:  Relationship Type is Customer and Status is Active. 3 Unit of Measure Business Central -> Sales Unit Groups 4 Currency Business Central -> Sales Transaction Currency 5 Items Business Central -> Sales and Sales -> Business Central Product Sales contact filter: Product Type is Sales Inventory 6 Sales Order Sales -> Business Central Sales Order 3 Posted Sales Invoice Business Central -> Sales Invoice

Share Story :

How to send Email Notification to Users using Workflow in Dynamics NAV

Introduction: Many a times in an Approval workflow, we need to notify the user by email to the Approver that approval request is sent also the sender needs to be notified whether the approval request sent is approved or cancelled. Hence, we need to setup Email Notification. Pre-requisites: Microsoft Dynamics NAV 2016 Office 365 Account Steps: 1. Setup SMTP Mail Setup Navigate to SMTP Mail setup from the Search bar. Click on Apply Office 365 Server Settings. Enter the UserID and Password (This is the sender’s email id. Mostly company email) 2. Setup Notification Template and Notification Setup Navigate to Notification Template and set Notification Method to E-mail for Type Approval Navigate to Notification Setup, for Notification Type Approval Schedule it Instantly.It can also be schedules Daily, Weekly, Monthly 3. Setup emails in the Approval User Setup In the Approval User Setup, enter the email id of each user in the email field. 4. Enable Mail Notify Job Queue. Navigate to the Job queue and enable Notify Job queue. The Mail Notify job queue is a standard job queue. When workflow is triggered having response Send approval request for the record and create a notification, Notification Entry is created in the Notification entries Record. This job fetches records from Notification entries and sends email to the recipient. The sent email can be viewed in the Sent Notification Entries page. Note: Delete the pre-existing Notification Entries of users with no email id or entries prior setting up emails 5. Sending email to the approver from workflow I’ve enabled standard Purchase Quote workflow. Open Purchase Quote and click on Send Approval Request. The status of the Purchase Quote changes to Pending Approval A notification email is sent to the approver.

Share Story :

How to send Notes to the Customer from a Custom Page using an Action button in Dynamics NAV

Business central from Dynamics 365 is an ERP solution from Microsoft which is designed to understand your business needs and change it for better.  Dynamics 365 business central development is a business management solution that is extremely easy to use and implement across several domains in your organization. Business central is the cloud version of the Dynamics NAV Platform. Which is being implemented by many companies across various industries in almost every part of the world. This cloud based ERP is designed for small and medium businesses which allows you to focus on your core business needs and strategies without having to invest on any infrastructure and installation. Implementation of Dynamic 365 business central to your organization helps you to connect your business and make smarter decisions. Introduction: The requirement is explained in the Scenario below: Scenario: A Custom page called Collection Module-Per User has details of Customers Transaction. This Collection Per User page is a List page. The User will select the line and Click on Notes. Notes will written and saved. The user will Click on the Action button Send Notes to Customer.TheNotes from this Custom page should be sent to standard page Customer (Page 18) Notes in Microsoft Dynamics NAV: Notes are like reminders or notification which is ideally used for Customers,Vendors or Items.  Notes are saved in binary format in a field Note of Blob data type in the table Record Link  (2000000068) Read notes : The “Record ID” of the record using Record Reference is used to filter the Record Link table and convert the data stored in the Note field in Record Link table to text. Write Notes: The “Record ID” of the record using Record Reference is used to filter the Record Link table and convert the text to bytes and store in the Note field Pre-requisites: Microsoft Dynamics NAV 2017 Steps: Functionality: 1. Select the line in the Custom page and click on Notes. Type in your Notes and Save it. 2. Click on Send Notes to Customer. 3. Open the Customer page and filter the Customer No to which Notes are sent and Open Notes. Customization: 1. Create an Action button Send Notes to Customer and create global variables as below image: 2. The Custom Table has primary key as No. so first GET the primary key and assign Customer No. to a variable Rec_CustNo ReadText: Rec_CF_CollectionModuleTempTable.GET(No); Rec_CustNo:=Rec_CF_CollectionModuleTempTable.CustNo; Set the Recfilter and use the Recorf reference to GETTABLE. Rec_CF_CollectionModuleTempTable.SETRECFILTER; CLEAR(RecRef); RecRef.GETTABLE(Rec_CF_CollectionModuleTempTable); RecRef.FINDFIRST; 3. SETRANGE with the Record Link’s Table Record ID and Record referrence RECORDID 4. Convert the blob field into text by using InStream and Use a BigText variable to read the Stream. RecordLink.RESET; RecordLink.SETCURRENTKEY(“Record ID”); RecordLink.SETRANGE(“Record ID”,RecRef.RECORDID); IF RecordLink.FINDFIRST THEN BEGIN RecordLink.CALCFIELDS(Note); IF RecordLink.Note.HASVALUE THEN BEGIN CLEAR(NoteText); RecordLink.Note.CREATEINSTREAM(Stream); NoteText.READ(Stream); NoteText.GETSUBTEXT(NoteText,2); END; END; Write Text: 1. GET the Customer No. of the Cuatomer Table and Use Record refernce to GETTABLE Customer. Use SetText function to write the text to bytes and store it in Note field in Record Link Customer.GET(Rec_CustNo); RecRef.GETTABLE(Customer); RecordLink.INIT; RecordLink.”Link ID”:=0; RecordLink.”Record ID”:=RecRef.RECORDID; RecordLink.URL1:=GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Page,PAGE::”Customer”); RecordLink.Type:=RecordLink.Type::Note; RecordLink.Created:=CURRENTDATETIME; RecordLink.”User ID”:=USERID; RecordLink.Company:=COMPANYNAME; RecordLink.Notify:=TRUE; SetText(NoteText,RecordLink); RecordLink.INSERT; The Complete Code : Send Notes to Customer – OnAction() Rec_CF_CollectionModuleTempTable.GET(No); Rec_CustNo:=Rec_CF_CollectionModuleTempTable.CustNo; //MESSAGE(‘%1 no’,Rec_CF_CollectionModuleTempTable.CustNo); Rec_CF_CollectionModuleTempTable.SETRECFILTER; CLEAR(RecRef); RecRef.GETTABLE(Rec_CF_CollectionModuleTempTable); RecRef.FINDFIRST; RecordLink.RESET; RecordLink.SETCURRENTKEY(“Record ID”); RecordLink.SETRANGE(“Record ID”,RecRef.RECORDID); IF RecordLink.FINDFIRST THEN BEGIN REPEAT RecordLink.CALCFIELDS(Note); IF RecordLink.Note.HASVALUE THEN BEGIN CLEAR(NoteText); RecordLink.Note.CREATEINSTREAM(Stream); NoteText.READ(Stream); NoteText.GETSUBTEXT(NoteText,2); MESSAGE(FORMAT(NoteText)); END; UNTIL RecordLink.NEXT=0; END; Customer.GET(Rec_CustNo); RecRef.GETTABLE(Customer); RecordLink.INIT; RecordLink.”Link ID”:=0; RecordLink.”Record ID”:=RecRef.RECORDID; RecordLink.URL1:=GETURL(CLIENTTYPE::Windows,COMPANYNAME,OBJECTTYPE::Page,PAGE::”Customer”); RecordLink.Type:=RecordLink.Type::Note; RecordLink.Created:=CURRENTDATETIME; RecordLink.”User ID”:=USERID; RecordLink.Company:=COMPANYNAME; RecordLink.Notify:=TRUE; SetText(NoteText,RecordLink); RecordLink.INSERT; PROCEDURE SetText@1000000002(NoteText@1000000000 : BigText;VAR RecordLink@1000000001 : Record 2000000068); VAR s@1000000002 : BigText; Ostr@1000000003 : OutStream; lf@1000000004 : Text; c1@1000000005 : Char; c2@1000000006 : Char; x@1000000007 : Integer; y@1000000008 : Integer; i@1000000009 : Integer; SystemUTF8Encoder@1000000011 : DotNet “‘mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.System.Text.UTF8Encoding”; SystemByteArray@1000000010 : DotNet “‘mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089’.System.Array”; BEGIN s := NoteText; SystemUTF8Encoder := SystemUTF8Encoder.UTF8Encoding; SystemByteArray := SystemUTF8Encoder.GetBytes(s); RecordLink.Note.CREATEOUTSTREAM(Ostr); x := SystemByteArray.Length DIV 128; IF x > 1 THEN y := SystemByteArray.Length – 128 * (x – 1) ELSE y := SystemByteArray.Length; c1 := y; Ostr.WRITE(c1); IF x > 0 THEN BEGIN c2 := x; Ostr.WRITE(c2); END; FOR i := 0 TO SystemByteArray.Length – 1 DO BEGIN c1 := SystemByteArray.GetValue(i); Ostr.WRITE(c1); END; END; LOCAL PROCEDURE HtmlEncode@20(InText@1000 : Text[1024]) : Text[1024]; VAR SystemWebHttpUtility@1001 : DotNet “‘System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’.System.Web.HttpUtility”; BEGIN SystemWebHttpUtility := SystemWebHttpUtility.HttpUtility; EXIT(SystemWebHttpUtility.HtmlEncode(InText)); END;

Share Story :

Explore Business Central API through Postman using Basic Authentication

Introduction: In this article, we will walk through steps on how to authenticate Business Central API using Basic Authentication in Postman Pre-Requisite: Business Central account Business Central API Basic authentication in Postman: In Postman, make a GET request to Business Central base API URL. Base URL: https://api.businesscentral.dynamics.com/v1.0/api/beta For using Basic Authentication, we need to add domain as well. Domain URL: https://api.businesscentral.dynamics.com/v1.0/myusersdomain.com/api/beta In Business Central, generate Web Service Access Key for your user. Now in Postman authorization tab, select Basic Auth in Type. Provide Username and Web Service Access Key Click Send

Share Story :

Setup Positive Pay Export

Introduction: What is Positive Pay Export and Why it’s used? Positive Pay Export is a file that is given to the bank to verify the Cheques that have been printed. Whenever the company wants to issue any payment to Customer or a Vendor, it is done with the help of Payment Journals. After creation of Payment Journal lines, the check is printed through a Report.  After the creation of the Check in the Bank Account there is an action called as PositivePayExport. This file is a text file and contains the information related to the Cheques printed and it is given to the bank. Every bank has their format which is used to automatically verify the Cheques that are being issued. Pre-requisites: Microsoft Dynamics NAV 2017 Demonstration: 1. Creating a Bank Account: To issue the cheque setting up Bank Account is mandatory. 2. Setting up the Data Exchange Definitions: Data Exchange Definition is used to set up the format for Positive Pay Export. The format for Export: Create a new Data Exchange Definition: Creating Column Definitions: Column Definition is the sequence in which the data is to be generated as per the format. Creating a Line Definitions: Line Definitions are used to map the System Fields to the fields in the column definitions. In the Line Definition, there are transformation rules that are used to modify the data that is exported into the format. Create a Line Definition and Select Field Mapping. There are some predefined Transformation Rules as well as new transformation Rules can be created. I’ve created the following transformation rules. I’ve shown the details of REPLACE transformation rule 3. Connecting the Data Exchange Definition with the Bank Account: To link the Positive Pay Export and the Bank Account, go to Bank Accounts and select the Positive Pay Export Code. 4. Creating Payment Journal Entries, Printing Cheques and Exporting the Positive Pay file. Creating Payment Journal Entry Printing the Check Report Positive Pay Export in Bank Account KEY4679 After Exporting Positive Pay Export the values generated in Positive Pay Export file are as follows. 000003296812746790000000012201805150000010200 000003296812746790000000013201805150000010512

Share Story :

How to Send Mail with attachment using Streams for reports with request page in Dynamics NAV

Scenario: On Customer Master page, an action button is created called Email customer, on click of the action button, an email has to be sent to the respective customer with attachment of the invoices in a .pdf format. Here, the report is saves as .pdf file. This report has a request page where Start Date and End date are entered by the user. Based on the date ranges, invoices generated for the particular user is mailed to the customer. Pre-requisites: Microsoft Dynamics NAV 2017 Steps: 1. Create a global function on the Customer master page to make a call to the codeunit. Here the Customer No. is passed as a parameter. 2. In the Function InvoiceMail, declare a parameter  CustNo. and the variables as follows: Here CustTempTable is a Temporary table The Code is added as follows: InvoiceMail(Custno : Code[20]) -Function Name SMTPMailSetup.GET; CustomerTable.RESET; CustomerTable.SETRANGE(“No.”,Custno); IF CustomerTable.FINDFIRST THEN BEGIN EmailID:=CustomerTable.”E-Mail”; CF_FTLCustomerInvoice.SETTABLEVIEW(CustomerTable); XmlParameters:=CF_FTLCustomerInvoice.RUNREQUESTPAGE(); CustTempTable.Parameters.CREATEOUTSTREAM(OStream,TEXTENCODING::UTF8); CustTempTable.Parameters.CREATEINSTREAM(IStream,TEXTENCODING::UTF8); REPORT.SAVEAS(50011,XmlParameters,REPORTFORMAT::Pdf,OStream); CLEAR(SMTPMail); SMTPMail.CreateMessage(”,SMTPMailSetup.”User ID”,EmailID,’Invoice Statement from CompanyName‘,”,TRUE); SMTPMail.AddAttachmentStream(IStream,’Customer Invoice’+ CustomerTable.Name+’.pdf’); SMTPMail.AppendBody(‘Hi ‘+CustomerTable.Name+’,’); SMTPMail.AppendBody(‘<br>’); SMTPMail.AppendBody(‘Please find attached your Customer Invoice statement’); SMTPMail.AppendBody(‘<HR>’); SMTPMail.AppendBody(‘This is a system generated mail. Please do not reply to this mail!’); SMTPMail.Send; MESSAGE(‘Mail sent to Customer %1’,Custno); END; Explaination of the code: 1. Set the SMTL Mail setup in the Role Tailored Client. Click on Apply Office 365 Server Settings. Add the Sender email (comapny email in my case) in User ID field and password of the email id in the Password field. 2. Store the Customer Email in the Email ID variable. 3. Pass the filters applied to the CustomerTable to the report variable CF_FTLCustomerInvoice. 4. Run the request page. The Run request page passes the request parameters in an xml format which is stored in a text variable XmlParameters. 5. Create an OutStream to save the the XmlParamters received in a File Parameters in a .xml format. 6. Create Instream to read the .xml file. 7. REPORT.SAVEAS(50011,XmlParameters,REPORTFORMAT::Pdf,OStream); saves the xmlparameters from the outsream in an pdf format. 8. Use SMTPMail.CreateMessage function to enter the sender’s and receipient’s  email, Subject  etc. 9. Add the attachement from the InputStream. 10. Draft a body of the email and Use SMTPMail.Send to Send the email. Yay.Email is Sent! Execution: 1.Click on Action button, Request page opens. 2. Enter the Start date and End date and click on OK. 3. An email is sent to the customer. Conclusion: Overview of the blog, first setup the SMTL Mail setup. Create an action button and create a function call. In the function defination, code as above and email is sent

Share Story :

How to change the font colour of a List page based on a condition in Dynamics NAV

Intoduction: The requirement was such that, based on a condition certain lines should appear in Red.This can be done by using page control Style Property. The Style property has ten values that apply different formats to field text as below: Value Format Standard Standard StandardAccent Blue Strong Bold StrongAccent Blue + Bold Attention Red + Italic AttentionAccent Blue + Italic Favorable Bold + Green Unfavorable Bold + Italic + Red Ambiguous Yellow Subordinate Grey Pre-Requisites: Microosft Dynamics NAV 2017 Steps: 1. Create a global variable i.e. on the View menu, choose C/AL Globals. 2. Define the variable, and then set the DataType to Boolean. 3. Open the Property of the variable then set the IncludeInDataSet to Yes. (I’ve use CFS_Repo as my boolean field). 4. Create a local function. (in my case UpdateStyle). 5. Now, code in the function. My requiremnt was such that if field  RepoInitiated is true then the line should should appear red. You can code as per tour requirement. 6. On the trigger OnAfterGetCurrRecord, call the function. 7. Now select the Field in the List page and click on Properties (Shift + F4) 8. Set the Style to Unfavorable and StyleExpr to CFS_Repo (the boolean field ) 9. Repeat the step 8 for all fields present on the list page.

Share Story :

SEARCH BLOGS:

FOLLOW CLOUDFRONTS BLOG :


Secured By miniOrange