Wednesday, December 31, 2014

OData Query to retrieve records based on record Guid

To retrieve the record based on Guid, below is the small code snippet to use.

function getRecordFromGuid() {
    var resultData = null;
    var uniqueId =RecordGuid;
    var oDataEndpointUrl = "http://yourservername/XRMServices/2011/OrganizationData.svc/";
    oDataEndpointUrl += "new_tempSet?&";

    oDataEndpointUrl += "$select=new_name&$filter=new_tempid eq guid'" + uniqueId + "'";
        type: "GET",
        url: oDataEndpointUrl,
        //data: jsonAccount,
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        beforeSend: function (XMLHttpRequest) {
            //Specifying this header ensures that the results will be returned as JSON.
            XMLHttpRequest.setRequestHeader("Accept", "application/json");
        success: function result(data) {
            resultData = data.d.results;

        async: false,
        error: function (xhr, textStatus, errorThrown) {


    if (resultData != null)
        return resultData;
        return null;

You may like below posts

Improving MS CRM Performance

Performance Center in MS CRM 2013

date and time field behavior in MS CRM

Upsert in MSCRM

Locking mechanism in MS CRM

Ticker Symbol Field in MS CRM

Themes in MS CRM

Enable Tracing in MS CRM

Calculated Field in Dynamics CRM 2015

IME Mode in MS CRM

No comments:

Post a Comment