function RetieveContact(executionContext)
{
var formContext = executionContext.getFormContext();
var recordId = formContext.data.entity.getId();
Xrm.WebApi.retrieveMultipleRecords("contact", "?$select=firstname,lastname&$filter=_parentcustomerid_value eq '+recordId +'").then(
function success(result){
for (var i = 0; i < result.entities.length; i++)
{
formContext.getAttribute("websiteurl").setValue("http://newvalue.com");
alert(result.entities[i].firstname);
formContext.data.entity.save("saveandclose");
break; // just for code demo
// Set value
}
},
function (error)
{
alert("Error: " + error.message);
}
);
}
//JavaScript source code
No comments:
Post a Comment