Tuesday 9 April 2019

Job to get contact person name and contact number of purchase order delivery address

In this blog, I will discuss how we can get the contact person name and contact number of purchase order delivery address located in the line details tab of PurchTable form.

Source Code:









public static void main(Args _args)
    {
        LogisticsElectronicAddress  electronicAddress;
        PurchTable                  purchTable;
        LogisticsLocation           logisticsLocation, logisticsLocationParent;

        purchTable = PurchTable::find("PurchaseOrderId");
        logisticsLocationParent = LogisticsLocation::find(purchTable.deliveryAddress().Location);

        select ParentLocation, RecId from logisticsLocation where
                logisticsLocation.ParentLocation == logisticsLocationParent.RecId;

        electronicAddress = LogisticsElectronicAddress::findByLocationAndType(logisticsLocation.RecId, LogisticsElectronicAddressMethodType::Phone);

        info(strFmt("Contact number: %1", electronicAddress.Locator));
        info(strFmt("Contact Person : %1", electronicAddress.Description));
    }

No comments:

Post a Comment

Key Updates in Dynamics 365 F&O for Version 10.0.39

Here’s a concise summary of the  platform updates  in  Microsoft Dynamics 365 Finance & Operations version 10.0.39 (March 2024) : 1- Add...