closed incomplete when tasked is not created in workflow

Brian Lancaster
Tera Sage

We recently changed or system to that is someone marks a task as closed incomplete it would make the RITM Closed Incomplete.   I am now running into an issues the below scenario.

With one request we have multiple tasks being created and going to a join.   There is times where I may need only 2 out of the 3 tasks.   If I use and if condition to not create one of the task it always sets the RITM as closed incomplete even if the other tasks are set to closed complete.     Any way around this?

1 ACCEPTED SOLUTION

Brian Lancaster
Tera Sage

I got an answer on this from HI.   Seems the join doesn't work the way you would expect.   It always goes down the incomplete path if one of the paths connected to it does not transition.   Here is how they had me get around this.   User create event with only giving it a name.   Basically a dummy event that doesn't really do anything.   Then have your catalog task that could get skipped go to the dummy event along with the if statement that bypasses the task. Then you would have the dummy event transition to your join.   After the joint you have to do another if statement to determine if any of the tasks are closed incomplete so you can set the RITM to closed incomplete if you that is what you want to do.   Below is a screenshot example of the workflow with the dummy event and the code for the IF statement if I mentioned above.


Dummy Event.png



answer = ifScript();


function ifScript()


{


  var task = new GlideRecord('sc_task');


  task.addQuery('request_item', current.sys_id);


  task.addQuery('state', '4');


  task.query();


  if(task.next())


  {


  return 'yes';


  }


  return 'no';


}


View solution in original post

6 REPLIES 6

Maybe there is some BR that determinas the activity results.   I noticed that in the comment of activity.result == 'incomplete' there is a short description of "At least one predecessor activities did not transition to this activity".


Brian Lancaster
Tera Sage

I got an answer on this from HI.   Seems the join doesn't work the way you would expect.   It always goes down the incomplete path if one of the paths connected to it does not transition.   Here is how they had me get around this.   User create event with only giving it a name.   Basically a dummy event that doesn't really do anything.   Then have your catalog task that could get skipped go to the dummy event along with the if statement that bypasses the task. Then you would have the dummy event transition to your join.   After the joint you have to do another if statement to determine if any of the tasks are closed incomplete so you can set the RITM to closed incomplete if you that is what you want to do.   Below is a screenshot example of the workflow with the dummy event and the code for the IF statement if I mentioned above.


Dummy Event.png



answer = ifScript();


function ifScript()


{


  var task = new GlideRecord('sc_task');


  task.addQuery('request_item', current.sys_id);


  task.addQuery('state', '4');


  task.query();


  if(task.next())


  {


  return 'yes';


  }


  return 'no';


}