cancel
Showing results for 
Search instead for 
Did you mean: 

signalling workflow task fails

mmaissan
Champ in-the-making
Champ in-the-making
Hi,

I have created a script which should signal a workflow to the next step.
This works in our test-environment, but the same script fails at a customer.
I receive the following error message when I try to execute it:
transaction has already been marked for rollback.
When I refresh the UI, nothing has changed.
When I signal the workflow in the UI, it works.

Could you please tell me what I'm doing wrong?

My script:
<javascript>
logger.log("Starting…");
var zaakId = args["zaakId"];
logger.log("Argument zaakId = " + zaakId);
var defs = workflow.getLatestDefinitions();
for (var a in defs){
  var b = defs[a];
  var instances = b.getActiveInstances();
  logger.log("Description:" + b.getDescription() + " Name:" + b.getName() + " Title:" + b.getTitle());
  for each(w in instances){
    logger.log("instance found:" + w.getDescription());
    var paths = w.getPaths();
    for (j = 0; j < paths.length; j++){
     var path = paths[j];
      var node = path.getNode();
      var tasks = path.getTasks();
      for (i = 0; i < tasks.length; i++){
        var task = tasks;
        var desc = task.getDescription();
        logger.log("Task.description:" + desc + " Task.name:" + task.getName() + " Task.title:" + task.getTitle());
        var taskProps = task.getProperties();
       if (taskProps["{http://www.alfresco.org/model/bpm/1.0}description"].search(zaakId)!= -1){
          logger.log("Taak gevonden");
          var trans = task.getTransitions();
          for (var k in trans){
            logger.log("Key is:" + k + ", value is:" + trans[k]);
            try
            {
              path.signal(k);
            }
            catch(exception){
              logger.log(exception.message);
            }
         break;
          }
        }
      }
    }
  }
}
</javascript>
2 REPLIES 2

mitpatoliya
Star Collaborator
Star Collaborator
Are you getting any of the logs from which you have added in your script?
I mean to say are able to figure what point it is failing?

mmaissan
Champ in-the-making
Champ in-the-making
Yes, it fails at path.signal(k)
when I comment this line, the script works.

Does anybody know a reason why path.signal() fails.
I tried task.endTask() too, which didn't work either.