Once sub task is closed then parent task state should change to work in progress

Talari Balateja
Tera Expert

Hi,

 

I'm looking into requirement. once the subtask is closed then parent task state should chnage to workinprogress.

 

Please help me to complete this task.

 

Parent: sn_si_incident

child: sn_si_task

 

 

Regards,

Sanju.

13 REPLIES 13

Hi @Pratiksha2 

 

I created Before Update BR on  sn_si_incident table, but it's not working.

 

TalariBalateja_0-1708614062113.png

 

 

@Talari Balateja 

Did you try my solution?

 

-Anurag

Hello @Talari Balateja - 

newTasks.addEncodedQuery(//add encoded query here to match the parent record on child table);


In my above code I have already mentioned that you have to put query to match parent record on child table do not put state should be close complete here then it will not work.

Hi @Pratiksha2 

 

updated encodedquery and not working

 

var newTasks = new GlideRecord("sn_si_task");
newTasks.addEncodedQuery('substate', '7');
newTasks.query();
var flag = false;
while (newTasks.next()) {
if (current.state != '3') {
flag = true;
}
}
if (flag == false) {

var grTask= new GlideRecord("sn_si_task");
grTask.addEncodedQuery('substate', '7');
grTask.query();
if(!grTask.next()){
var incidentReq = new GlideRecord("sn_si_incident");
if (incidentReq.get(current.number)) {
incidentReq.setValue('substate', '4');
incidentReq.update();
}
}
}