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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

How do I get a contact's account with Web API?

(0) ShareShare
ReportReport
Posted on by 15

I can get an account's contacts easily enough, with 

accounts?$select=name&$expand=contact_customer_accounts($select=contactid)

but how can I do the reverse? I can't seem to figure it out. I can do:

contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=account_primary_contact($select=name)

but this will only give me account info if the contact is a primary contact of that account. How do I get just the related account?

I would guess it's this, but this doesn't work:

contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=accounts($select=name)

Edit: I just found you can get the account id from `_parentcustomerid_value`, but this requires then a separate call to accounts(<accountid>) to get account info. There's got to be a better way, right?

I have the same question (0)
  • erhan.keskin Profile Picture
    2,253 on at

    Hi,

    Please use this instead;

    contacts?$select=firstname,lastname,emailaddress1,telephone1&$expand=parentcustomerid_account($select=name)

    Regards,

  • cloflyMao Profile Picture
    25,210 on at

    Hi Partner,

    If your contact's accounts means below:(in Related - Commons)

    pastedimage1571409308329v1.png

    then you could retrieve them with 

    https://org.crm.dynamics.com/api/data/v9.0/contacts(id)?$select=firstname,lastname&$expand=adx_account_created_by_portal_contact($select=name)

    pastedimage1571409450100v2.png

    The relationship is in contact's 1:N

    pastedimage1571409481759v3.png

    Regards,

    Clofly

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 70 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 33 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans