Hello all,
I want to create a function to retrieve the maximum length value of fullname from Contact entities. My function looks like this:
function getCustomerNameMaxLegth() {
var max_length;
max_length = 0;
var vres = "";
try {
var oDataURI = Xrm.Page.context.getClientUrl()
+ "/XRMServices/2011/OrganizationData.svc/ContactSet?$select=FullName";
var req = new XMLHttpRequest();
req.open("GET", oDataURI, false);
req.setRequestHeader("Accept", "application/json");
req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
req.send();
if ((req.readyState == 4) && (req.status == 200)) {
var vrecord = JSON.parse(req.responseText).d;
if (vrecord.results != "") {
vres = vrecord.results[0].FullName;
if (vres.length > max_length) {
max_length = vres.length;
}
}
}
}
catch (e) {
alert("Error:" + e);
}
return max_length;
}
The problem with this function is that it looks for the maximum value only in first 50 records from contact. In my contact entity i have 3000 records and i want to get the maximum length value from entire list of records.
How can i do that?
Thanks!
*This post is locked for comments
I have the same question (0)