web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Contact information for Customer and Legal entity

(0) ShareShare
ReportReport
Posted on by 56

Hi all,

Can you please let me know

1. How I will get Contact formation like Phone and Fax number from CUSTOMER  ?

2. How I will get Contact formation like Phone and Fax number from Legal entity ?

Through code.

Please give me more shed on this 

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    303,988 Super User 2026 Season 1 on at

    Hi @rp@n,

    The details are stored in the table LogisticsElectronicAddress. This is linked to the DirPartyTable via a location in the LogisticsLocation table. The DirPartyTable is the global address book record which is linked to a legal entity or a customer.

  • @rp@n Profile Picture
    56 on at

    thanks Andre,

    kindly send me the code for customer and legal entity please.

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    405 on at

    1. How I will get Contact formation like Phone and Fax number from CUSTOMER  ?

    There are couple of methods on 'CustTable' to get phone number, you can change address method type to get 'Fax' number.

    Methods on CustTable.

    display Phone phone()
    {
    LogisticsElectronicAddress electronicAddress;
    
    electronicAddress = DirParty::primaryElectronicAddress(this.Party, LogisticsElectronicAddressMethodType::Phone);
    if (!electronicAddress)
    {
    electronicAddress = DirParty::getElectronicAddressForPartyPostalAddress(this.Party, LogisticsElectronicAddressMethodType::Phone);
    }
    
    return electronicAddress ? electronicAddress.Locator : '';
    }
    
    display PhoneLocal phoneLocal()
    {
    LogisticsElectronicAddress electronicAddress;
    
    

    2. How I will get Contact formation like Phone and Fax number from Legal entity ?

    Same methods exists on company info to get contact information.

    Methods on CompanyInfo

    //BP deviation documented
        display Phone phone()
        {
            LogisticsElectronicAddress electronicAddress;
    
            electronicAddress = DirParty::primaryElectronicAddress(this.RecId, LogisticsElectronicAddressMethodType::Phone);
    
            return electronicAddress ? electronicAddress.Locator : '';
        }
    
        //BP deviation documented
        display PhoneLocal phoneLocal()
        {
            LogisticsElectronicAddress electronicAddress;
    
            electronicAddress = DirParty::primaryElectronicAddress(this.RecId, LogisticsElectronicAddressMethodType::Phone);
    
            return electronicAddress ? electronicAddress.LocatorExtension : '';
        }

    I hope this answers your question. 

  • @rp@n Profile Picture
    56 on at

    hi Vishal,

    i have wrote the below code for customer

    party       = custTable.Party;

    logisticsElectronicAddress = DirParty::primaryElectronicAddress(party, LogisticsElectronicAddressMethodType::Phone);

           if(logisticsElectronicAddress)

           {

               locator = logisticsElectronicAddress.Locator;

           }

           logisticsElectronicAddress2 = DirParty::primaryElectronicAddress(party, LogisticsElectronicAddressMethodType::Fax);

           if(logisticsElectronicAddress2)

           {

               locator2 = logisticsElectronicAddress2.Locator;

           }

    but not get any output. it's coming cblank. anything wrong??

  • André Arnaud de Calavon Profile Picture
    303,988 Super User 2026 Season 1 on at

    Hi @rp@n,

    Have you checked if the phone and fax records for this customer are marked as primary? This coding is searching for records with the field Primary checked.

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    405 on at

    Hi @rp@n,

    Above code is to get the primary contact information of customer and company.

    Can you please check if contact information is added to customer and company and if it is primary.

    If you are trying to get contact information which is not primary, you can get it by following code,

    phone = conPeek(DirParty::electronicAddressLocatorsByRole(companyInfo.RecId,
                                                    LogisticsElectronicAddressMethodType::Phone,
                                                    'Delivery'),1);
     

    'Delivery' in above code is contact 'purpose', Please make sure you are passing correct 'purpose' in the code. You can check that by selecting contact record -> Click advanced and check 'purpose'.

  • @rp@n Profile Picture
    56 on at

    Yes, Andre and Vushal

    They are not marked Primary. Let me chk

    Thanks

  • @rp@n Profile Picture
    56 on at

    Vishal,

    as you mentioned

       display Phone phone()

       {

           LogisticsElectronicAddress electronicAddress;

           electronicAddress = DirParty::primaryElectronicAddress(this.RecId, LogisticsElectronicAddressMethodType::Phone);

           return electronicAddress ? electronicAddress.Locator : '';

       }

    here this. recid means companyinfo.recid  rite?

    i wrote below code for phone and fax for company

    company         = CompanyInfo::find();

    logisticsElectronicAddress3 = DirParty::primaryElectronicAddress(company.RecId, LogisticsElectronicAddressMethodType::Phone);
    if(logisticsElectronicAddress3)
    {
    locator3 = logisticsElectronicAddress3.Locator;
    }

    logisticsElectronicAddress4 = DirParty::primaryElectronicAddress(company.RecId, LogisticsElectronicAddressMethodType::Fax);
    if(logisticsElectronicAddress4)
    {
    locator4 = logisticsElectronicAddress4.Locator;
    }

    is it rite? becuase value is not coming. i marked primary for both

  • Martin Dráb Profile Picture
    239,082 Most Valuable Professional on at

    Why did you duplicate the code instead of just calling the method?

    CompanyInfo::find().phone()

    If it doesn't work, you don't seem to have the right data in the current company.

    The debugger might help you to understand what's going on in your system.

  • @rp@n Profile Picture
    56 on at

    yeah rite, let me chk

    for fax ? i could not find any method in company info

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 653

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 493 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 317 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans