Tuesday 27 August 2019

Get customer multiple contact details in dynamics 365 F&O X++

In this example I will be showing you how to get a customer contact details  like phone num, email, fax and URL's.

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


dirPartyLocation.clear();
dirParty = DirPartyTable::findRec(custTable.Party);
        while select dirPartyLocation where dirPartyLocation.Party == dirParty.RecId
            join logisticsElectronicAddress
            where logisticsElectronicAddress.Location == dirPartyLocation.Location
        {
            ContactContract = new ContactContract();
            LogisticsElectronicAddressMethodType logisticsElectronicAddressMethodType  = logisticsElectronicAddress.Type;
            
            logisticsLocation.clear();
            logisticsLocation = LogisticsLocation::find(dirPartyLocation.Location);
            ContactContract.parmDescription(logisticsLocation.Description);
            ContactContract.parmIsPrimary(logisticsElectronicAddress.IsPrimary);
            ContactContract.parmLocator(logisticsElectronicAddress.Locator);
            ContactContract.parmType(enum2Str(LogisticsElectronicAddressMethodType));

            LogisticsElectronicAddressRole logisticsElectronicAddressRole;
            select * from logisticsElectronicAddressRole where logisticsElectronicAddressRole.ElectronicAddress == logisticsElectronicAddress.RecId;
            logisticsLocationRole = LogisticsLocationRole::findRec(logisticsElectronicAddressRole.LocationRole);
            if(logisticsElectronicAddressRole)
            {
                ContactContract.parmPurpose(enum2Str(logisticsLocationRole.Type));// Type Invoice, business, home etc

            }

No comments:

Post a Comment

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...