Posts

Importing records from excel using X++ code

  we are trying to import data from Excel to D365FO through the following job. Create a job :- using System.IO; using OfficeOpenXml; using OfficeOpenXml.ExcelPackage; using OfficeOpenXml.ExcelRange; class BASEmployeeDataImportJob {     /// <summary>     /// Runs the class with the specified arguments.     /// </summary>     /// <param name = "_args">The specified arguments.</param>          public void run()     {         this.updateDailyAttendance();     }     void updateDailyAttendance()     {         System.IO.Stream                stream;         ExcelSpreadsheetName            sheeet;         FileUploadBuild                 fileUpload;       ...

Exporting records from master table(D365FO) to excel using X++ code

  we are trying to export data from master table to Excel  through the following job. Create a job :- using System.IO; using OfficeOpenXml; using OfficeOpenXml.Style; using OfficeOpenXml.Table; class BASCustInfoExportJob {     /// <summary>     /// Runs the class with the specified arguments.     /// </summary>     /// <param name = “_args”>The specified arguments.</param>     public static void main(Args _args)     {         BAS_Employees employees;         MemoryStream memoryStream = new MemoryStream();         using (var package = new ExcelPackage(memoryStream))         {             var currentRow = 1;             Filename fileName = "Emp.xlsx";             var worksheets = package.get_Workbook().get_Worksheets();   ...

X++ Code to import data from excel and getting path of uploaded file by clicking a button

  Create button and over ride clicked method :- Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange; class BASUploadButton  {              /// <summary>     /// Runs the class with the specified arguments.     /// </summary>main(Args _args)     /// <param name = "_args">The specified arguments.</param>     ///              public static void main(Args _args)     {         System.IO.Stream            stream;         ExcelSpreadsheetName        sheet;         FileUploadBuild             fileUpload,fileUploadBuild;         DialogGroup                 dialogUploadGroup;   ...

Creation of Trade agreement journal for Purch through X++ code

  Create a class :-  class BASTradeJournal {     public static void main(Args _args)     {         // BASTradeAgreementTable tradeAgreementTable = _args.record();         BASTradeAgreementTable tradeAgreementTable;         MultiSelectionHelper selectHelper = MultiSelectionHelper::createFromCaller(_args.caller());         InventDim               inventDim;         InventTrans             inventTrans;         InventDimId             inventDimId;         PriceDiscAdmTable       priceDiscAdmTable;         PriceDiscAdmTrans       priceDiscAdmTrans;         PriceDiscAdmCheckPost   priceDiscAdmCheckPost = new PriceDiscAdmCheckPost...

Validating data of a table and giving warning upon clicking a button

  On click of a button :-  [Control("Button")]     class BASValidateButton     {         /// <summary>         ///         /// </summary>         public void clicked()         {                         BASPurchaseOrderEntity purch;//,notVendor;             while select * from purch             {                 VendTable       vendTable;                 InventTable     inventTable;                 InventDim       inventDim;                 //validation for Vendor               ...

Creation of multiple PO and posting invoices for the same through X++

  Upon a clicking a button POs will be creating and posting invoices by using data which are stored in custom table (Mandatory data have been stored in data source) On Clicked():-  [Control("Button")]     class BASPostButton     {         /// <summary>         ///         /// </summary>         public void clicked()         {             BASPurchaseOrderEntity purchOrder;             while  select * from purchOrder             {             //Data entity declaration               PurchPurchaseOrderHeaderV2Entity  purchTable;                  PurchPurchaseOrderLineV2Entity    purchLine;           ...