Tuesday, August 27, 2019

Get Sales Order Address in dynamics 365 F&O X++

In this example I will be showing you how to get a sales order delivery address using below code.

Here, I'm inserting the data in my contract class to use in my API classes.  Pleases change it according to your requirement.

        logisticsPostalAddress = LogisticsPostalAddress::findRecId(salesTable.DELIVERYPOSTALADDRESS);
        if(logisticsPostalAddress)
        {
            select RecId from logisticsLocation index hint
                LogisticsLocationIdx where logisticsLocation.RecId ==  logisticsPostalAddress.Location;

            select RecId from dirPartyLocation where dirPartyLocation.Location == logisticsLocation.RecId;
            
            SalesAddressContract = new SalesAddressContract();
            SalesAddressContract.parmAddressDescription(logisticsLocation.Description);
            SalesAddressContract.parmDeliveryAddressName(DIRPARTYTABLE::findRec(dirPartyLocation.Party).Name);
            SalesAddressContract.parmAddressStreet(logisticsPostalAddress.Street);
            SalesAddressContract.parmAddressCity(logisticsPostalAddress.City);
            SalesAddressContract.parmAddressState(logisticsPostalAddress.State);
            SalesAddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
            SalesAddressContract.parmAddressZipCode(logisticsPostalAddress.ZipCode);
            SalesAddressContract.parmAddressCountryRegionId(logisticsPostalAddress.CountryRegionId);
            SalesAddressContract.parmsunTAFMarkForExtAddressCode(logisticsLocation.ExtAddressCode);// Custom field

            addressList.addEnd(SalesAddressContract);

        }

@Rahul

1 comment:

Power Automate vs Azure Logic Apps vs Azure Data Factory: What They Are, When to Use Them, and How to Integrate Non-Microsoft Systems

  In today’s cloud-first, API-driven enterprise landscape, automation and integration have become vital pillars of operational agility. Micr...