In lifecycle event, Activityset(Triggertype=Advanced)script is running, activityset waits Interval

Gudipati Hemala
Tera Contributor

I have a lifecycle event for onboarding process, I have following activity sets

 

GudipatiHemala_0-1692816298097.png

 

Once the 'Expected start date' of 'subjected person' reaches, it should do to  "Day 1" activity set and If all mandatory HR tasks are completed, I have close the LE case.

 

-----------------------------------------script in Day 1 activity set  --------

(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */ ,
    hrTriggerUtil /* hr_TriggerUtil script include instance */ ) {
 if ((current_date >= gdtTz.getDate())) {       //current_date is today's date and gdtTz.getDate() is 'Expected start date' of 'subjected person
        if (hrTriggerUtil.checkActivitySetsCompleted(<sys_id of Day 1 Prep>) {
           var gr = new GlideRecord('sn_hr_core_task');
            gr.addQuery('parent.sys_id', parentCase.sys_id);
            gr.addQuery('state', "IN", "1,6,7"); //draft,ready,workinprogess (fetches )
            gr.addQuery('optional', false);  //checks mandatory tasks
            gr.query();
            if (!gr.next()) {
                parentCase.setWorkflow(false);
                parentCase.active = false;
                 parentCase.state = 3; //close complete
                 parentCase.update();
                 parentCase.setWorkflow(true);
                return true;
            }
}
----------------------------------
I have Evaluation Interval as 4 hrs. But When I create a LE case, The 'Day 1' script is running and closing the LE case (before moving to Day 1 activity set)  However , the Activity set is still showing "Day 1 Prep". I Think Day 1 script is executed and closed the LE case however its still waiting for Evaluation interval to move to Day 1 activity set. Since, here the LE case closed  it will not move further.
 
GudipatiHemala_2-1692817823876.png

what I need is LE case should be closed after moving to "Day 1" activity set not before(not in Day 1 Prep), could you please help me to get it done ? Thanks

 

 

 

 

0 REPLIES 0