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

Notifications

Announcements

Community site session details

Community site session details

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

How to retrieve 'owneridtype' or 'cutomeridtype' field of a record using web api?

(0) ShareShare
ReportReport
Posted on by 25

I try to find the referenced record of a table. 'ownerid' and 'customerid' are multiple targets lookup attributes, I want to find out which table those fields are referenced to. Looks like 'owneridtyp' and 'cutomeridtype' could give me the information I need, but those 2 fields are not retrievable. How can I find out which target table the record referenced to in this case? I need this through web API. 

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

    if you are using the Web API endpoint add the formatted values (the request header for it)

    and you will see an additional property "logicalname" for the lookup fields telling you the logical name of the table the record is pointing to, for example for ownerid (_ownerid_value) will tell you if is a systemuser or a team record 

  • Verified answer
    meelamri Profile Picture
    13,218 User Group Leader on at

    Hi, 

    Record owners:

    Xrm.WebApi.retrieveRecord("account", "d8862a8c-90fe-eb11-94ef-002248800dd0", "?$select=name,_ownerid_value")
        .then(function(result) {
            var account = {
                "accountname": result["name"],
                "ownerid" : result["_ownerid_value"],
                "owneridtype" : result["_ownerid_value@Microsoft.Dynamics.CRM.lookuplogicalname"]
            }
            console.log(account);
        })

    pastedimage1633362834696v3.png

    The Customer field: 

    Xrm.WebApi.retrieveRecord("opportunity", "1d2e438e-1621-4b0e-ae9a-529e06b16d0e")
        .then(function(result) {
            var opportunity = {
                "opportunityName": result["name"],
                "customerid" : result["_customerid_value"],
                "customeridname": result["_customerid_value@OData.Community.Display.V1.FormattedValue"],
                "customeridtype": result["_customerid_value@Microsoft.Dynamics.CRM.lookuplogicalname"]
            }
            console.log(opportunity);
        })

    pastedimage1633362812811v2.png

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…

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 60 Super User 2026 Season 1

#2
Eugen Podkorytov Profile Picture

Eugen Podkorytov 26

#3
CU07021359-0 Profile Picture

CU07021359-0 23 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans