Hi All,
We have a CRM Application for which we had a library to make CRUD operations using REST and SOAP, since CRM will soon stop supporting that so we are moving all the JavaScript to WEBAPI calls.
Initially we had a fetchxml which executes and give responses which we then parse.
But now the same fetchxml response is a bit wired.
1) If the attribute is of Lookup(EntityReference) then in WEBAPI i'm getting only guid but not the entityname and name of the lookup record. This attribute name is also a bit different for eg if the attribute name is "sw_product" then in response the attribute name would be "_sw_product_value".
2) Since I am not getting the name of a lookup record so thought of using linked-entity and tried to add the name field of lookup record, I am getting the response but again the schema name gets appends to some characters eg - productlink_x002e_name. (productlink - is the alias name).
Any Suggestions on how to do this?
Thanks,
Vijay
*This post is locked for comments
HI
You have to include in the web API header below
retrieveReq.setRequestHeader("prefer", "odata.include-annotations="*");
try:
var guid = yourlookupfield[0].id;
var name = yourlookupfield[0].name;
var entitytype = yourlookupfield[0].entityType;
Stay up to date on forum activity by subscribing. You can also customize your in-app and email Notification settings across all subscriptions.
André Arnaud de Cal... 291,253 Super User 2024 Season 2
Martin Dráb 230,188 Most Valuable Professional
nmaenpaa 101,156