Close all HR tasks
Fri Sep 22 2023 03:30:34 GMT+0000 (Coordinated Universal Time)
Saved by
@RahmanM
/* Complete all the Tasks and Child cases for the parent HR cases */
var parentCaseSysId = '<>';
// Close all the tasks
var grSnHrCoreTask = new GlideRecord('sn_hr_core_task');
grSnHrCoreTask.addEncodedQuery("parent=" + parentCaseSysId + "^state!=3^ORstate=NULL");
grSnHrCoreTask.query();
while (grSnHrCoreTask.next()) {
grSnHrCoreTask.setValue('state', 3);
grSnHrCoreCase.setWorkFlow(false);
grSnHrCoreTask.update();
}
// Close all the child cases
var grSnHrCoreCase = new GlideRecord('sn_hr_core_case');
grSnHrCoreCase.addEncodedQuery("parent=" + parentCaseSysId + "^state!=3^ORstate=NULL");
grSnHrCoreCase.query();
while (grSnHrCoreCase.next()) {
grSnHrCoreCase.setValue('state', 3);
grSnHrCoreCase.setWorkFlow(false);
grSnHrCoreCase.update();
}
content_copyCOPY
Close SNOW hr tasks
Comments