Servicenow HRSD Lifecycle Event

TahiraS
Tera Expert

I want the activity set to get triggered based on the value of one of the fields on the parent case.  I tried the script but its not getting triggered:

I'm not sure how to utilize audience since we want to look at the previous step for the current lifecycle case.

This is the script I'm using, please help.  I did change the evaluation interval to 4 minutes for the activity set and even tried the 4 hours to check next day but its not getting triggered.

 

(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */,
                              hrTriggerUtil /* hr_TriggerUtil script include instance */) {
        var gr = new GlideRecord('sn_hr_le_case');
        gr.addQuery('parent', parentCase.sys_id.toString());
        gr.addQuery('some_field''Fail');
        gr.query();
       
        if (gr.next())
            return true;  
        else
            return false;
})(parentCase, hrTriggerUtil);
1 ACCEPTED SOLUTION

michaelj_sherid
ServiceNow Employee
ServiceNow Employee

@TahiraS It is not recommended to reduce the Evaluation Interval value for this purpose. Starting in San Diego, we introduced an enhancement to trigger activity sets in more real time. Here is more information on that functionality which is the recommended approach for your use case.

 

If my answer has helped with your question, please mark my answer as an accepted solution and give a thumbs up.

Regards,

Mike

View solution in original post

5 REPLIES 5

@TahiraS What result the following script prints when you run it via a background script/fix script.

 

   var gr = new GlideRecord('sn_hr_le_case');
        gr.addQuery('parent', parentCase.sys_id.toString()); //Replace parentCase.sys_id.toString() with sys_id of LE case
        gr.addQuery('some_field', 'Fail');
        gr.query();
       
        if (gr.next())
            gs.info('true');
        else
            gs.info('false');