AnsweredAssumed Answered

Invoking a webscript from share & Transaction

Question asked by romschn on Oct 18, 2011

I have created a webscript which will end a parallel workflow task which is working absolutely fine if I run it from browser.

Now, I am trying to integrate this webscript in share. Basically, on click of one transition button I want to end a parallel workflow task.
In tranistion.js, I am writing below code to invoke the webscript.
var updateFields = function(res) {
           var result = eval('(' + res.serverResponse.responseText + ')');                                               

         Alfresco.util.Ajax.jsonGet( {
            url: Alfresco.constants.PROXY_URI + "revokeTask?taskId=" + taskId,
                 successCallback : {
                        fn : updateFields,
                        scope : this
                 failureCallback : {
                        fn : function() {},
                        scope : this

This code is written inside the onclick method for a transition button. In this method, at the end the form is being submitted.

The problem I am facing is - the above code did not wait for the script to get executed first and then submit the form.
So, everytime it gives me the error - Row was updated or deleted by another transaction.

Could anyone please help me - how can I make sure that once the webscript is executed and it deletes the task then only the form is submitted…

Thanks for your help in advance.