Monday, 31 December 2018

Import records from Excel using X++ code in D365FO

In this blog I will discuss how we can import records from Excel file in Dynamics 365 Finance and Operations.

Please see below screenshot with source code explanation:

Explanation of Source Code (1.1):
  • Add / Use following namespaces in the class. 


Explanation of Source Code (1.2):
  • Initialize and declare classes and data types.
  • Create a dialog object, which will open as form.
  • Add controls (Import, Upload and buttons).















Explanation of Source Code (1.3):
  • Get and load Excel file.
  • Get the row count for record iteration.
  • Iterate record and get the columns values on every iteration.















Result:
























That is all you need to do for creating a class which imports record from Excel.

Job to create default dimension having dimension attribute and value in D365FO

In this blog I will discuss how we create the default dimension having dimension attribute and dimension attribute values.

Please see below screenshot with source code explanation.

Explanation of source code (1.1):
  • In this section of Job Main method I have called the createDefaultDimension Method.
  • In this method I have passed three dimension attribute values.






Explanation of source code (1.2):
  • createDefaultDimension Method with three argurments.
  • Initialization and declaration of classes and data types.
  • Pass argument having dimension values and store into container.
  • After container is filled with dimension attributes and its values, iterate it.














Explanation of source code (1.3):
  • Iteration of dimension attributes.
  • Check dimension attribute exists or not.
  • Get the dimension attribute value.
  • Add the values of dimension in value Set Storage class by using add Item method.













Result:

Run the class (Job).












That is all you need to do to create default dimension record Id.

Monday, 24 December 2018

Job to post pending vendor invoice through X++ code in D365FO

In this blog I will discuss how you we can post pending vendor invoice. For that I have created a job and using PurchFormLetter_Invoice class which will post the invoice.

Please see below screenshot and explanation of source code.

Explanation of source code:
  • Initialize of tables and class variables.
  • Get purchase order table.
  • Get vendInvoiceInfoTable table buffer by purchase order Id and pending vendor invoice number.
  • Update match status invoice.
  • Initialize PurchFormLetter_Invoice class.
  • Update purchase order parameter table.
  • Call PurchFormLetter_Invoice class update method.
    • Argument-1: Purchase order table buffer.
    • Argument-2: Pending vendor invoice number.
    • Argument-3: Posting date.
    • Argument-4: Purchase update type.
    • Argument-5: Account order status.
    • Argument-6: Proforma invoice is set to NO.
    • Argument-7: Print management option is set to NO.
That is all you need to do for posting pending vendor invoice through X++ code in Dynamics 365 Finance and Operations. For creating pending vendor invoice you can follow my previous blog Job to create pending vendor invoice through X++ code in D365FO.

Job to create pending vendor invoice through X++ code in D365FO

A vendor invoice from a purchase order is an invoice that is produced when products or services are received according to a purchase order that was placed with a vendor. The vendor invoice contains a header, and one or more lines for items or services. A vendor invoice completes the cycle from purchase order to product receipt to vendor invoice. In this blog I will discuss how we can create pending vendor invoice through X++ code in Dynamic 365 finance and operations. So lets begin.

Please follow series of screenshots of source code with explanation:

Source code explanation: (1.1)
  • Initialization of table buffers.
  • Get purchase order table. 
  • Get purchase order lines.
  • Get vendor table.























Source code explanation: (1.2)

  • Insert data in VendInvoiceInfoTable table.
  • This table contains the vendor invoices for one or more purchase orders.
  • Assignment of values.

















Source code explanation: (1.3)
  • Insert data in VendInvoiceInfoSubTable table.
  • This table contains the associations between the vendor invoices and the purchase orders.
  • Assignment of values.










Source code explanation: (1.4)
  • Insert data in VendInvoiceInfoLine table.
  • This table contains vendor invoice lines for a specific purchase order.
  • Assignment of values.














Source code explanation: (1.5)
  • Insert data in VendInvoiceInfoSubLine table.
  • This table contains associations between the vendor invoice lines and the posted vendor packing slips.
  • Assignment of values.













That is all you need to do for creating pending vendor invoice through X++ code.

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...