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

Community site session details

Session Id :
Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Issue getting the account's owner contact

(0) ShareShare
ReportReport
Posted on by 57

Hello

I'm able to extract data from CRM using the APIs and having issues obtaining the account's owner contact.

While using the following url (companyname and client name replaced

companyname.crm.dynamics.com/.../accounts eq 'client name'

I'm able to obtain 

,"_ownerid_value":"546f4265-55b9-e411-806b-f0921c195204"

but while trying to use the following url to get the owners data (companyname replaced
https://companyname.crm.dynamics.com/api/data/v9.1/contacts?$select=contactid,firstname,lastname&$filter=contactid eq '546f4265-55b9-e411-806b-f0921c195204'
I get empty result.

Thank you in advance for your support.


I have the same question (0)
  • Suggested answer
    PabloCRP Profile Picture
    1,088 on at
    RE: Issue getting the account's owner contact

    Hi Enediel Gonzalez,

    there you are filtering by contactid if your need filter by owner should be

    $&filter=_ownerid_value eq '546f4265-55b9-e411-806b-f0921c195204'.

    Regards

    please consider marking as an answer if it was helpful
  • Enediel Gonzalez Profile Picture
    57 on at
    RE: Issue getting the account's owner contact

    Hello everyone, thank Pablo for your answer but my goal is to find the owner's contact for each account, if you notice I do the first query using the "account" entity, taking the owner_id from there and trying to find it in the "contact" entity returning empty result.

    Is there any relationship diagram between all the entity fields?

    Greetings

  • PabloCRP Profile Picture
    1,088 on at
    RE: Issue getting the account's owner contact

    Hi, your ODATA query could be like

    /api/data/v9.0/accounts?$select=name,[HERE CAN PLACE MORE COLUMNS]&$expand=primarycontactid($select=_ownerid_value)&$filter=primarycontactid/contactid ne null and accountid eq [HERE YOUR ACCOUNT ID]

    Regards.

  • Enediel Gonzalez Profile Picture
    57 on at
    RE: Issue getting the account's owner contact

    Thank Pablo again

    I tried the following based in your suggestion (companyname changed)

    companyname.crm.dynamics.com/.../accounts ne null and accountid eq '42f000f2-2dba-e411-ace1-6c3be5a85de8'

    as answer I got

    ..primarycontactid":{"_ownerid_value":"4af8f02e-452d-e411-a820-6c3be5a85de8","contactid":"db17140a-f169-ea11-a811-000d3a55d2c3"}}]}

    using "contactid":"db17140a-f169-ea11-a811-000d3a55d2c3" I get the primary contact for the account but not the owner of it.

  • PabloCRP Profile Picture
    1,088 on at
    RE: Issue getting the account's owner contact

    Hi, please provide the query you are running which is failing, remember that the example above returns owners contact for selected account.

    e.g. ...accountid eq '42f000f2-2dba-e411-ace1-6c3be5a85de8'

    if you pass a GUID of contact it won't work because it needs an account.

    Regards

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Sahan Hasitha Profile Picture

Sahan Hasitha 271

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 91 Super User 2025 Season 2

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 76 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans