Quantcast
Channel: CRM Development forum
Viewing all articles
Browse latest Browse all 8223

Update WorkerId in QueueItem entity

$
0
0

Hi!

I'm trying to update WorkerId(in QueueItem) with XrmSvcToolkit.updateRecord and get Success in Return but nothing happens!

Any good ideas?

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("Det oppstod en feil, vennligst kontakt EVRY Select SystemUser: " + error.description);
                }

            });
                         
        },
        errorCallback: function (error) {

            alert("Det oppstod en feil, vennligst kontakt EVRY. Select QueueItem: " + 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("Oppdatert OK - QueueItemId: " + queueitemid + " - UserName: " + systemUser.FullName);

        },

        errorCallback: function (error) {

            alert("Det oppstod en feil, vennligst kontakt EVRY. Update QueueItem: " + error.description);

        }

    });
}
BR Knut


Viewing all articles
Browse latest Browse all 8223

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>