I want to check TASK status in the workflow if task is cancelled I want Make RITM and REQ closed or If TASK is cancelled I want to Make RITM/REQ cancelled?

Shantharao
Kilo Sage

Hello All,

I want to check TASK status in the workflow, if TASK is closed I want Make RITM and REQ closed and If TASK is cancelled I want to Make RITM/REQ cancelled, I want check task status in work flow and then set up RITM/REQ status from workflow, please find the below screen shot 

 

find_real_file.png

 

Thanks

1 ACCEPTED SOLUTION

Shantharao
Kilo Sage

Finally got the solution 

 

Since the workflow is on the Requested item, current.task.state refers to current requested item status which is not closed complete. hence all the requested items are going to cancelled state. use below script after the catalog task activity.

 

 

 

answer = check();

 

function check()

 

{

 

var gr_tsk = new GlideRecord("sc_task");

 

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

 

gr_tsk.query();

 

gr_tsk.next();

 

if(gr_tsk.state == 4) //check for task status closed incomplete

 

{

 

  return 'yes';

 

  }

 

  return 'no';

 

}

 

 

 

after if, for yes you will have Set values activity with status and stage as Closed complete and completed respectively. for no, it will be Closed incomplete and Request Cancelled.

 

 

 

remember, this will work if there is only one task for the requested item.

View solution in original post

15 REPLIES 15

did the same thing but its not working

 

show me the workflow screenshot 

If I closed TASK working fine but, If I cancelled task it is not working

 

are you sure the state value is correct here.

the steps which i have mentioned is correct, when you cancelled the task is it going with "always" transition ? if yes then what have you mentioned in always transition condition ? 

 

i am assuming here you have mentioned the same condition with difference state value for always transition 

If I closed it is working fine closed back end state value is "3"

find_real_file.png

 

If I cancelled the TASK, not working task state cancelled back end value is "-10"