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;       Dialog dialog=new Dialog("Excel Import using dialog");       dialogUploadGroup=dialog.addGroup("@SYS54759");       formBuildControl=dialog.formBuildDesign().control(dialogUploadGroup.name());    

Get customer or vendor email address based on the purpose in AX/D365 FO X++


static void Vend_CustEmailUsingPurpose(Args _args)
{
    VendTable                           vendTable; //for customer you can change CustTable.
    DirPartyLocation                    dirPartyLocation;
    LogisticsElectronicAddress          logisticsElectronicAddress;
    LogisticsElectronicAddressRole      logisticsElectronicAddressRole;
    LogisticsLocationRole               logisticsLocationRole;
  
    select firstOnly vendTable
        where vendTable.AccountNum == '‪‪‪US-105';
  
    while select dirPartyLocation
        where dirPartyLocation.party == vendTable.Party
    {
        while select logisticsElectronicAddress
            where logisticsElectronicAddress.Location == dirPartyLocation.Location
                && logisticsElectronicAddress.Type == LogisticsElectronicAddressMethodType::Email
        {
            while select logisticsElectronicAddressRole
                where logisticsElectronicAddressRole.ElectronicAddress == logisticsElectronicAddress.RecId
                join logisticsLocationRole
                where logisticsLocationRole.RecId == logisticsElectronicAddressRole.LocationRole
                && logisticsLocationRole.Name == strFmt("%1",logisticsLocationRoleType::Business)
            {
                info(strFmt("%1 - %2", logisticsElectronicAddress.Locator, logisticsLocationRole.Name));
            }
        }
    }
}

Comments

Popular posts from this blog

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

Customize SSRS report using extension in D365FO

CREATE AND POSTING PURCHASE ORDER THROUGH X++ DYNAMICS AX