HR task state change

anusarma
Kilo Expert

Hi All,

We have a workflow in HR lifecycle events application scope, in which we are generating multiple HR tasks at a time under a HR case. One of the task, say task A, is set to be in a "pending" state when generated. This is configured in the workflow in the "create task" activity. This task is dependent on another task, say task B. When task B changes state to "closed complete", then task A should change state to "ready". We are trying to achieve this from the workflow using a "run script" activity after task B is closed. However, it is not working as required when we tested as impersonating the task assignee and closing task B. Task A continues to be in the "pending" state even after task B is closed when done like this. However, if we as system administrator closes the task B directly from the "state" field dropdown, then task A is getting updated to ready state. We are not sure why it is not happening if we impersonate as task assignee and closes task B.

We also tried to achieve this using business rule in HR lifecycle events application, it is behaving the same way as when done via workflow.

We also tried the same business rule in HR core application scope. However, it didn't work then as well.

Could someone please suggest what could be the possible issue and solution?

Thanks in advance,

Anu

1 ACCEPTED SOLUTION

We were finally able to fix this issue, by adding a timer activity for 3s before the run script activity. It was found that when user tries to close the task and at the same time, system tries to update the state of another task, it would take the lowest access level and tries to update the task based on that, due to which it was not working for those users, but only for admins. When a timer activity was included, then system will update the state of the other task without any issues.

View solution in original post

9 REPLIES 9

Munender Singh
Mega Sage

Hi,

Could you please share the Business rule ocnditions and scripts for better understanding.

Regards,

Munender

Table: sn_hr_core_task

When to run: before 100, on update

Filter condition: task short description is "..." AND state changes to "closed complete"

Script:

var gr_tsk = new GlideRecord("sn_hr_core_task");
gr_tsk.addQuery('parent', current.parent.sys_id);
gr_tsk.addQuery('assignment_group','<sys_id of the required assign group>'); //to get the task for which state needs to be updated to ready
gr_tsk.query();

if(gr_tsk.next())
{
gr_tsk.state = 10; //state = ready
gr_tsk.work_notes = "This task is now ready to be worked on.";
gr_tsk.update();
}

----------------------------------------------------------------------

Hi,

Can you please check if the business rule is on scoped application or global aplication.?

 

Regards,

Munender

Business rule is on HR Lifecycle Events scoped application.

With this configuration, the state of task A is getting updated upon closing task B if tested from admin perspective. It is not working when impersonating as the task assignee and then closing task B.