Hi,
Is it possible to use alternate key on custom api when input parameter is type of Entity Reference. Then in payload to custom api call instead of entity reference in form of table name and record id use, alternate key from source table.
example payload:
{
"contactid": {
"@odata.type": "Microsoft.Dynamics.CRM.contact",
"customalternatekey" : "uniquevalue01"
}
}
C# example call:
EntityReference contactIdKey= new EntityReference("contact", "customalternatekey", "uniquevalue01");
OrganizationRequest request = new OrganizationRequest("new_apitest")
{
Parameters =
{
["contactid"] = contactIdKey,
}
};
var response = client.Execute(request);
Thanks for the interesting discovery! Never thought to use the alternate key that way!
thanks for the confirmation!
I checked it again on morning and it was issue with my plugin that give error with dictionaries, and I was almost sure it was corelated with payload data.
So alternate key for custom API are working.
interesting question, honestly I never tried but I don't think it's possible. Did you try and got a specific error?
EDIT: user confirmed is possible
ankit_singhal
11
Super User 2025 Season 1
mmbr1606
9
Super User 2025 Season 1
CU07050602-0
4