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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 184 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 125

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans