Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics AX forum
Suggested answer

Contact information for Customer and Legal entity

Posted on by 5,877

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 

  • @rp@n Profile Picture
    @rp@n 5,877 on at
    RE: Contact information for Customer and Legal entity

    yes rite, sure Martin

  • Martin Dráb Profile Picture
    Martin Dráb 224,528 Super User on at
    RE: Contact information for Customer and Legal entity

    Please read the previous replies. Both questions have already been answered there.

  • @rp@n Profile Picture
    @rp@n 5,877 on at
    RE: Contact information for Customer and Legal entity

    sure Martin, i believe this two are consider primary rite?

    if not primary then how i will get?

  • Martin Dráb Profile Picture
    Martin Dráb 224,528 Super User on at
    RE: Contact information for Customer and Legal entity

    It's called teleFax() in D365FO; I assume it's the same in AX 2012 too.

  • @rp@n Profile Picture
    @rp@n 5,877 on at
    RE: Contact information for Customer and Legal entity

    yeah rite, let me chk

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

  • Martin Dráb Profile Picture
    Martin Dráb 224,528 Super User on at
    RE: Contact information for Customer and Legal entity

    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
    @rp@n 5,877 on at
    RE: Contact information for Customer and Legal entity

    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

  • @rp@n Profile Picture
    @rp@n 5,877 on at
    RE: Contact information for Customer and Legal entity

    Yes, Andre and Vushal

    They are not marked Primary. Let me chk

    Thanks

  • Suggested answer
    Vishal Dhavgaye Profile Picture
    Vishal Dhavgaye 405 on at
    RE: Contact information for Customer and Legal entity

    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'.

  • André Arnaud de Calavon Profile Picture
    André Arnaud de Cal... 283,632 Super User on at
    RE: Contact information for Customer and Legal entity

    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.

Helpful resources

Quick Links

Can you answer this forum question?

You could make someone's day!

Community Newsletter - May 2024

Kudos to our community stars!

Community Spotlight of the Month

Kudos to Mohamed Amine Mahmoudi!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 283,632 Super User

#2
Martin Dráb Profile Picture

Martin Dráb 224,528 Super User

#3
nmaenpaa Profile Picture

nmaenpaa 101,146

Featured topics

Product updates

Dynamics 365 release plans