Hi!
I'm trying to update WorkerId(in QueueItem) with XrmSvcToolkit.updateRecord and get success in return but nothing happens!
Any good ideas what I'm doing wrong?
Here is my code:
function setIncidentWorkedOn(incidentGuid) {
var iGuid = incidentGuid.replace("{", "'").replace("}", "'");
var queueitemid;
var systemUser;
//Get the QueueItem entity
var filterQueryQueueItem = "?$filter=ObjectId/Id eq guid" + iGuid;
XrmSvcToolkit.retrieveMultiple({
entityName: "QueueItem",
async: false,
odataQuery: filterQueryQueueItem,
successCallback: function (result) {
queueitemid = result[0].QueueItemId;
//Get the user entity
var uRef = Xrm.Page.context.getUserId();
XrmSvcToolkit.retrieve({
entityName: "SystemUser",
id: uRef,
async: false,
successCallback: function (resultUser) {
systemUser = resultUser;
},
errorCallback: function (error) {
alert(error.description);
}
});
},
errorCallback: function (error) {
alert(error.description);
}
});
//Update QueueItem - WorkerId attribute with user
XrmSvcToolkit.updateRecord({
entityName: "QueueItem",
id: queueitemid,
entity: { WorkerId: systemUser.Id },
async: false,
successCallback: function (resultUpdate) {
//Xrm.Page.data.entity.save();
alert("Success!");
} ,
errorCallback: function (error) {
alert(error.description);
}
});
}
*This post is locked for comments