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 :
Microsoft Dynamics 365 | Integration, Dataverse...
Answered

Get EntityReference fields from Opportunity entity using OData

(0) ShareShare
ReportReport
Posted on by 10

I was given a Fetch XML and used it lik so: /api/data/v9.0/opportunities?$count=true&fetchXml=%3.........

the results gave me just the IDs of the related names I expected, not the names.

It C# and  Microsoft.PowerPlatform.Dataverse.Client.Dynamics I get the names just by adding them to  q.ColumnSet = new ColumnSet({here}

and the result is of type "EntityReference" but I need this query for JavaScript.

When I add the referenced to the $select=, i get error that they do not exist . also when I use them in &expand=   

Is there a syntax I am missing to do this in REST?

Thank you

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    the OData syntax of lookups is different (they don't use the logical name) use my tool Dataverse REST Builder to build the query and generate the JavaScript code to read the result.

  • OferGal Profile Picture
    10 on at

    This ownsome. thank you man!

    I was able to get all the formatted values.

    The only item I can't figure out is in a one to one relation.

    In C# I get it with 

     q.LinkEntities.Add(new LinkEntity("opportunity", "ecg_org", "ecg_practice", "ecg_orgid", JoinOperator.Inner));
     q.LinkEntities[0].Columns.AddColumns("ecg_division");
     q.LinkEntities[0].EntityAlias = "Practice";

    The XML has

          
    

    I use React fetch so I need to npm Xrm.Utility.? 

    until now I just got a token and put it in the header.

    Thanks again

  • Guido Preite Profile Picture
    54,086 Moderator on at

    with my tool you can fetch the relationships, under Table there are the relationships (one-to-many, many-to-one, many-to-many) press select and find the relationship and the columns you want to fetch

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 > Microsoft Dynamics 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 64 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans