I've created a function which returns the record in an entity where a field is equal to a certian value.
How can i now get the guid of this record.
function getCurrentLabourRate() { var serverUrl = Xrm.Page.context.getServerUrl(); var oDataUrl = serverUrl + "/xrmservices/2011/OrganizationData.svc/c2_labourrateSet?$filter=c2_Status/Value eq 745670000" jQuery.ajax({ type: "GET", contentType: "application/json; charset=utf-8", datatype: "json", url: oDataUrl, async: false, beforeSend: function (XMLHttpRequest) { XMLHttpRequest.setRequestHeader("Accept", "application/json"); }, success: function (data, textStatus, XmlHttpRequest) { if (data && data.d != null && data.d.results != null) { var labourRateCurrentRecord = data.d; } }, error: function (XmlHttpRequest, textStatus, errorThrown) { alert("Error : has occured during retrieval of the records "); } }); }I believe below only selects the record of the entity c2_labourrate where the status of an option set is equal to the value 745670000 the name in the optionset of this value is current.
/xrmservices/2011/OrganizationData.svc/c2_labourrateSet?$filter=c2_Status/Value eq 745670000"