Am wading through converting CRM 4 to 2011 and have gone blank on how to update a record:
var serverUrl = document.location.protocol + "//" + document.location.host + "/" + Xrm.Page.context.getOrgUniqueName();
var oDataEndpointUrl = serverUrl + "/XRMServices/2011/OrganizationData.svc/";
oDataEndpointUrl += "A_counterSet?$select=A_counterId, A_Count&$filter=A_name eq 'A_Ref'";
var service = GetRequestObject();
if (service != null)
{
service.open("GET", oDataEndpointUrl, false);
service.setRequestHeader("X-Requested-Width", "XMLHttpRequest");
service.setRequestHeader("Accept", "application/json, text/javascript, */*");
service.send(null);
var requestResults = eval('(' + service.responseText + ')').d;
if (requestResults != null && requestResults.results.length > 0)
{
var value = requestResults.results[0].A_Count;
var CCount = parseFloat(value) +1;
var res = getNo(Xrm.Page.getAttribute("A_pcode").getValue()) + CCount;
Xrm.Page.getAttribute("A_projectreference").setSubmitMode("always");
Xrm.Page.getAttribute("A_projectreference").setValue(res);
var CCountID = requestResults.results[0].A_counterId;
}
}
I am retrieving a counter and then want to add 1 to it and then write this back to the system, just struggling to understand how.
*This post is locked for comments
I have the same question (0)