How to Import Records from Excel Using X++ Code in D365FO

  How to Import Records from Excel Using X++ Code in D365FO   Include the below namespace in X++ code it will requires to import Excel. Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange;   In addition to the basic reference, include (Directory and DirectoryUpgrade Packages) X++ Code: Using System.IO; Using OfficeOpenXml; Using OfficeOpenXml.ExcelPackage; Using OfficeOpenXml.ExcelRange; class ReadExcel {   public static void main(Args _args)    {     Int id;     Str Name;      System.IO.Stream stream;       ExcelSpreadsheetName sheet;              FileUploadBuild fileUpload,fileUploadBuild;       DialogGroup dialogUploadGroup;       FormBuildControl formBuildControl;   ...

D365 FO Packing slip using X++ and taking current packing slip record

 D365 FO Packing slip using X++ and taking current packing slip record

static void postPackingSlip(Args _args)

{

SalesFormLetter salesFormLetter;

SalesTable salesTable;

SalesId salesId = ‘SO00001’;

System.Exception error;

str strError;

CustPackingSlipJour custPackingSlipJour;

;

 

ttsBegin;

try

{

salesTable = SalesTable::find(salesId);

 

if (salesTable && salesTable.SalesStatus == SalesStatus::Backorder)

{

salesFormLetter = SalesFormLetter::construct(DocumentStatus::PackingSlip);

salesFormLetter.update(salesTable, systemDateGet(), SalesUpdate::PackingSlip, AccountOrder::None, NoYes::No, NoYes::No, NoYes::No);

 

 

custPackingSlipJour = salesFormLetter.parmJournalRecord();

info(strFmt(‘New Packing Slip #:%1 successfully created for Sales Order #:%2’, custPackingSlipJour.PackingSlipId, custPackingSlipJour.SalesId));

 

}

else

{

info(strFmt(‘%1 does not exsists or null in the system, please try again!’, salesId));

}

 

}

catch (Exception::CLRError)

{

error = CLRInterop::getLastException();

strError = error.ToString();

 

info(strfmt(‘%1’, strError));

info(strFmt(‘%1 failed to delivered, please try again!’, salesId));

}

ttscommit;

}

Comments

Popular posts from this blog

D365 FO: REFRESH CALLER FORM DATA SOURCE FROM A CLASS X++

Passing Args from one Form to another Form in dynamics AX

CREATE AND POSTING PURCHASE ORDER THROUGH X++ DYNAMICS AX