Some useful snippets when using the Wep API
Get record via alternate key when using Web API via Http request Entra/Preauthenticated
cm_outdooractivities table has an alternate key cm_sqlid and below selects the record with Id = 1
https://org.crm11.dynamics.com/api/data/v9.2/cm_outdooractivities(cm_sqlid=1)?$select=cm_outdooractivityid
https://org.crm11.dynamics.com/api/data/v9.2/cm_outdooractivities?$select=cm_outdooractivityid&$filter=cm_sqlid eq 1
Update a lookup value using the WebApi
{
"cm_instructor@odata.bind" : "/accounts(<account guid>)",
...}
If the column is a lookup to different table - e.g parent customer can be contact or account then use _account to specify
"parentcustomerid_account@odata.bind": "/accounts(00000000-0000-0000-0000-000000000000)"
Bypassing validation logic
Use the below in the request header:
MSCRM.BypassBusinessLogicExecution: CustomSync,CustomAsync
Setting a lookup value to null
Use an Http Delete with the Url with $ref at the end
http://org.crm.dynamics.com/api/data/v8.0/<lookup table logical name>(record id)/<logical name of relationship>/$ref
e.g. to delete account/primary contact
http://org.crm.dynamics.com/api/data/v8.0/accounts(record id)/primarycontactid/$ref
for 1:N relationships
http://org.crm.dynamics.com/api/data/v8.0/<lookup table logical name>(record Id)/<logical name of relationship>(record Id)/$ref
