SC_tasks created via workflow is assigned automatically set to state closed unsuccessful

Gayathree Seeth
Tera Expert

Tasks created via workflow is assigned automatically to closed unsuccessful.

Can any one pls assist me here.

 

11 REPLIES 11

I tried deactivating the custom BR's i find on this table but it seems not working the also.

Also i have around 20 if conditions in my WF is that fine?

I tried giving 2 if blocked and checked but then that was working. If i branch 20 if blocks then this is happening.

 

 

rambo1
Tera Guru

 

Please check all BR's on sc_task (insert,update)

Also check flow from which sc_task is getting created, check if there is any logic thats setting state of sc_task to 'closed unsucessful'

hi rambo

YEs i after the approval is approved the task is created and assigning to closed unsuccessful state.

Also i have around 20 if conditions in my WF is that fine?

I tried giving 2 if blocked and checked but then that was working. If i branch 20 if blocks then this is happening.

 

Uncle Rob
Kilo Patron

If its happening instantaneously its either a business rule or another workflow or flow designer.

The good news is if its a business rule it will be easy enough to search for.
Just query business rules where table = sc_task and script contains "Closed Unsuccessful" (or whatever the value is associated to that label)

Im seeing below code :when state changes, before update:
 
(function executeRule(current, previous /*null when async*/) {
    var last_task = false;
    var all_close = new GlideRecord('sc_task');
    all_close.addQuery('sys_id', '!=', current.sys_id);
    all_close.addQuery('request_item', current.request_item);
    all_close.query();
//  gs.log('all_close' + all_close);
   
   
    while (all_close.next())
        {
        if(all_close.state == 20 )  
            {
            last_task = true;
        }
       
    }
    var item=new GlideRecord('sc_req_item');
    item.addQuery('sys_id', current.request_item);
    item.query();
   
    if(item.next()){
       
         // gs.log('test' + "" + last_task);
       
    if(current.state== 20 && last_task == true )
            {
            //gs.log('inloop');
            item.state=3;
            item.u_sub_status='Cancelled';
            item.active = false;
            item.update();
       
        }
    }
   
})(current, previous);