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,...
Unanswered

Contact creation error with binding to entity id

(0) ShareShare
ReportReport
Posted on by
I have a Dynamics CRM instance that I am initially successfully accessing via Postman.
This is v9.0

I have a POST request which creates a new contact at: /api/data/v9.0/contacts

{
    /customertypecode/: 127840004,
    /xx_contractorstatus/: 127840000,
    /firstname/: /Wallie/,
    /lastname/: /Worker1-7/,
    /fullname/: /Wallie Worker/,
    /emailaddress1/: /wworker1@test.com/
}

I also have a custom list of nationalities at: /api/data/v9.0/xx_nationalities

The structure of xx_nationalities is:

​​​{
    /@odata.context/: https://xxdev.api.[HIDDEN].dynamics.com/api/data/v9.0/$metadata#xx_nationalities/,
    /value/: [
        {
            /@odata.etag/: /W////35347625////,
            /_organizationid_value/: /6b47908f-b289-4601-b80c-59667d32deda/,
            /xx_sharecoderequired/: true,
            /xx_nationalityid/: /297db2c4-15a3-ed11-aad1-0022484257f7/,
            /xx_name/: /Afghan/,
            /xx_wrsregistrationrequired/: false,
            /xx_visarequired/: true,
            /statuscode/: 1,
            /importsequencenumber/: 20,
            /_createdby_value/: /2c738c48-4115-ec11-b6e6-002248412237/,
            /modifiedon/: /2023-02-02T16:22:38Z/,
            /xx_brprequired/: true,
            /_modifiedby_value/: /2c738c48-4115-ec11-b6e6-002248412237/,
            /versionnumber/: 35347625,
            /createdon/: /2023-02-02T16:22:38Z/,
            /statecode/: 0,
            /overriddencreatedon/: null,
            /_modifiedonbehalfby_value/: null,
            /xx_nationalityfullname/: null,
            /utcconversiontimezonecode/: null,
            /_createdonbehalfby_value/: null,
            /xx_iseu/: null,
            /timezoneruleversionnumber/: null
        }
    ]
}

I need to attach a nationality to the contact upon Contact creation but am getting errors. When xx_nationality is returned within a Contact GET it is named as:
/_xx_nationality_value/: /5f7db2c4-15a3-ed11-aad1-0022484257f7/
 
I have tried direct to returned value, with id, using @odata.bind, with entity wrapping and with. / without slash in value and underscore in property. But nothing seems to work.
/_xx_nationality_value/: /5f7db2c4-15a3-ed11-aad1-0022484257f7/
error: CRM do not support direct update of Entity Reference properties, Use Navigation properties instead
 
/_xx_nationality_value@odata.bind/: //xx_nationalities(5f7db2c4-15a3-ed11-aad1-0022484257f7)/
/xx_nationalityid@odata.bind/: //xx_nationalities(5f7db2c4-15a3-ed11-aad1-0022484257f7)/
/xx_nationalityid_nationalities@odata.bind/: /xx_nationalities(5f7db2c4-15a3-ed11-aad1-0022484257f7)/
/xx_nationalityid_nationalities@odata.bind/: //xx_nationalities(5f7db2c4-15a3-ed11-aad1-0022484257f7)/
 
error: Microsoft.OData.ODataException: An undeclared property '_xx_nationalityid_nationalities' which only has property annotations in the payload but no property value was found in the payload
 
This seems to be something which is probably obvious but this is our first excursion into hitting the CRM and we can't find a solution within the docs and unfortunately we can't download the /api/data/v9.0/$metadata file as its too large to browser or Postman.

My suspician is that because our CRM is setup to use //xx_nationalities/ instead of //nationalities/ that this is screwing around the solution of how to target.

I.e. instead of [property]_[entitycollection] eg nationalityid_nationality@odata.bind
we're trying something more like:
xx_nationalityid_xx_nationality@odata.bind

But maybe the singular does work with the prepending xx.

Any help gratefully received!

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
11manish Profile Picture

11manish 109 Super User 2026 Season 2

#2
Syed Aqib Raza Profile Picture

Syed Aqib Raza 88

#3
ParthPatel249 Profile Picture

ParthPatel249 82

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans