Skip to main content

Notifications

Announcements

No record found.

Customer experience | Sales, Customer Insights,...
Unanswered

How can I get the account primary contact in expand?

Posted on by 15

https://xxxxxxxx.api.crm.dynamics.com/api/data/v9.2/accounts(a415b010-3663-eb11-bb23-000d3a5913d3)?$select=name&$expand=primarycontactid($select=fullname,emailaddress1)

pastedimage1613704289328v1.png

the full name, email have values.

but when get the same data in multiple level expand,

https://xxxxxxxxxxx.api.crm.dynamics.com/api/data/v9.2/oci_outcomechains(4A5AE6D9-B471-EB11-A812-000D3A374259)?$select=oci_name,oci_id,oci_oc_description&$expand=oci_OutcomeChain_Opportunity_Relationship($select=name,opportunityid,createdon),oci_OutcomeChain_Account_Relationship($select=name,address1_city,telephone1,_primarycontactid_value;$expand=primarycontactid($select=fullname,emailaddress1))

pastedimage1613704468729v2.png

  • cloflyMao Profile Picture
    cloflyMao 25,198 on at
    RE: How can I get the account primary contact in expand?

    Hi Partner,

    Are you using online version Dynamics?

    What's the relationship between your Outcomechain entity and Account?

    Is it also a N:1 relationship?(account is lookup field of outcomechain)

    I created a custom entity Doctor and add Account as its lookup field.

    So relationships of these 3 entities are:

    Doctor -> Account (N:1) 

    Account -> Contact (N:1)

    Primary contact data is available when using multiple expand:

    https://aaa.crm5.dynamics.com/api/data/v9.2/new_doctors(3F4F2E69-1356-EB11-A812-00224816BC2D)?$select=new_name,new_email&$expand=new_Account($select=name,address1_city,telephone1,_primarycontactid_value;$expand=primarycontactid($select=fullname,emailaddress1))

    6281.gg.JPG

    Try removing select operator to return all attributes to check whether fullname and emailaddress1 are still null.

    Or please let me know which Dynamics app you are using which might be helpful to me to reproduce the issue, because I copied your query URL, but it didn't return "__DisplayName__" and "IsReferencedQueryCall" attributes in my environment.

    (I tested the API in Dynamics 365 for Marketing app.)

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,235 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans