I want to create a new lead in MS Dynamics, but I have some issues with "address1_country". When I give a value for "address1_country" e.g. "BE", it doesn't update.
It seems to be a lookup field.
This is the body:
I found it, thanks!
The solution for us was:
"cos_CountryId@odata.bind":"/cos_countries(ff5de506-6f14-eb11-a812-000d3a201451)",
Please check below point.
1. Check the schema name of country field update the request as
"SchemaName@odata.bind":"/puralname(GUID)"
2. if step 1 does not work the go with navigation property as described below link:
https://carldesouza.com/the-trick-to-updating-custom-lookups-using-the-dynamics-365-web-api/
Thanks,
Pradeep.
Please mark this as VERIFIED, if it helps,
We already tried this:
"cos_countryid@odata.bind":"/cos_countries(fb5de506-6f14-eb11-a812-000d3a201451)",
"cos_countryId@odata.bind":"/cos_countries(fb5de506-6f14-eb11-a812-000d3a201451)",
but without any luck.
I always get these responses from Postman:
"An undeclared property 'cos_countryid' which only has property annotations in the payload but no property value was found in the payload. In OData, only declared navigation properties and declared named streams can be represented as properties without values."
Postman inserts using D365 WebAPI correct?
Assuming thats correct, and assuming you are using a custom entity for country and using a lookup field to it, you may need to do something like this:
JSONLead["new_countryid@odata.bind"] = "/new_countries(DFE54660-37CD-E511-80DE-6C3BE5A831DC)"
If you are using a Global OptionSet for country, you will need to use the long integer value of the specific optionset value you want to set it to.
We're using JSON to create a lead via Postman. So how would that work then?
If you are using JavaScript to set the field value, you will need to get and use the Guid for the desired county, along with its name and the entity type as shown in the code below.
var CountryId = {desired record's guid}; var CountryName = "Belgium"; var CountryEType = "country"; var lookupArray = new Array(); lookupArray[0] = new Object(); lookupArray[0].id = CountryId; lookupArray[0].name = CountryName; lookupArray[0].entityType = CountryEType; formContext.getAttribute("address1_country").setValue(lookupArray);
If you are using a Power Automate Cloud Flow, C# Plugin, or a Traditional D365 Workflow, let me know and I can provide the details of how you need to implement this using the desired component.
Daivat Vartak (v-9d...
225
Super User 2025 Season 1
Eugen Podkorytov
106
Muhammad Shahzad Sh...
106
Most Valuable Professional