There may a scenario to retrieve records using a picklist value throug OData query. Below is the small piece of code to retrieve the same.
function GetRecordsBasedonPicklistValue() {
var plateType = 427345000;//Picklist value
var oDataEndpointUrl = "http://youservername/xrmservices/2011/OrganizationData.svc/";
oDataEndpointUrl += "new_itemtypeSet?&";
oDataEndpointUrl += "$select=new_name&$filter=new_picklistype/Value eq " + plateType;
$.ajax({
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) {
errorCallback(this._errorHandler(xhr));
}
});
if (resultData != null)
return resultData;
else
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
function GetRecordsBasedonPicklistValue() {
var plateType = 427345000;//Picklist value
var oDataEndpointUrl = "http://youservername/xrmservices/2011/OrganizationData.svc/";
oDataEndpointUrl += "new_itemtypeSet?&";
oDataEndpointUrl += "$select=new_name&$filter=new_picklistype/Value eq " + plateType;
$.ajax({
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) {
errorCallback(this._errorHandler(xhr));
}
});
if (resultData != null)
return resultData;
else
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