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 Address By Type In D365/AX X++


Below are the solutions to get customers by address type(Invoice , delivery)

Solution 1
------------------
display Addressing  InvoicingAddress()

{

Addressing address;

DirPartyRecId party;

party = CustTable::find(‘Account’).Party;

address = DirParty::getPostalAddressByType(party, LogisticsLocationRoleType::Invoice);

if (!address)

address = DirParty::getPostalAddressByType(party, LogisticsLocationRoleType::Delivery);

return address;

}


Solution 2
--------------
//LogisticsLocationRoleType (Invoice, Delivery, Shipping etc.)
public static LogisticsPostalAddress getPostalAddressByType(DirPartyRecId _party, LogisticsLocationRoleType _type)
{
    DirPartyLocation        partyLocation;
    DirPartyLocationRole    partyLocationRole;
    LogisticsLocation       location;
    LogisticsLocationRole   locationRole;
    LogisticsPostalAddress  postalAddress;

    select firstonly postalAddress
        exists join location
            where location.RecId == postalAddress.Location
        exists join locationRole
            where locationRole.Type  == _type//LogisticsLocationRoleType::Invoice
        exists join partyLocation
            where
                partyLocation.Location == location.RecId &&
                partyLocation.Party == _party//custtable.party
        exists join partyLocationRole
            where partyLocationRole.PartyLocation == partyLocation.RecId &&
                partyLocationRole.LocationRole == locationRole.RecId;

    return postalAddress;
}

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