Hi,
I am new to web api in CRM using D365 8.2 version
I have 2 webapi requests which are similar in terms of entity relationships, query header but one returns parent lookup text and other just the ID of the lookup.
Query1: new_fundraiser is the parent with _divisionid_value the look up that's returning both lookup ID and text value
------------------------------------------------------------------------------------------------------------------------------------
var serverURL=Xrm.Page.context.getClientUrl() + "/api/data/v8.2/new_fundraisings("+thisGUID+")?$select=new_cardnameholder1,_new_fundraisingevent_value&$expand=new_FundRaiser($select=contactid,fullname,_divisionid_value)";
req.open("GET", serverURL,true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
Jason result :
new_FundRaiser: {@odata.etag: "W/"3827216"", contactid: "11cc2f0a-9267-e711-80db-005056919b9d",
fullname: "Abbey Hakala FMPA", _upbeat_divisionid_value@OData.Community.Display.V1.FormattedValue: "NSW", _upbeat_divisionid_value@Microsoft.Dynamics.CRM.associatednavigationproperty: "upbeat_DivisionId", …}
Query2: new_FundName is the parent with _new_fundnamedivision_value the look up returning only the ID :(
-------------------------------------------------------------------------------------------------------------------------------
var serverURL= Xrm.Page.context.getClientUrl() + "/api/data/v8.2/new_fundraisingcontactses("+thisGUID
+")?$select=_new_contact_value,new_fundraisingcontactsid&$expand=new_FundName($select=new_cardnameholder1,_new_fundnamedivision_value)";
debugger;
req.open("GET",serverURL, true);
req.setRequestHeader("OData-MaxVersion", "4.0");
req.setRequestHeader("OData-Version", "4.0");
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.setRequestHeader("Prefer", "odata.include-annotations=\"*\"");
Jason result:
new_FundName:
@odata.etag: "W/"3973444""
new_cardnameholder1: null
new_fundraisingid: "da3c0ae0-8b57-e911-811a-005056919b9d"
_new_fundnamedivision_value: "86d7df92-8767-e711-80db-005056919b9d"
Any help will be much appreciated.
*This post is locked for comments