Activity Set - Advanced Trigger Condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 03:56 AM
Hi, Community.
We have this requirement to set trigger condition for one of our activity set.
1. After closure of HRTASK
2. When Employee Number is not empty
3. if customField is set to false.
below is my script.
(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */ , //Complete HR Task })(parentCase, hrTriggerUtil); |
However, after completing the tasks, and the subject person profile has employee number and customField is set to false, it's always evaluating to false.
Can anyone help?
- Labels:
-
HR Service Delivery

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-13-2022 05:02 AM
Hi
If you are sure that both employee number and custom field are correct then the first condition hrTask.hasNext() might be false
Check having logs for these three conditions
hrTask.addQuery('parent', parentCase);
hrTask.addQuery('template', templatesysID);
hrTask.addQuery('state', 3);
And also you can put logs for employeeNumber, customField, templatesysID these three declared variables and see what values they are printing.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 12:30 AM
Hi, the script is working fine in background script execution it is returning true. However, we have decided to add a custom field instead in sys_user table to accompany all conditions only in one table. I have one more question, it would be great if you could check - https://community.servicenow.com/community?id=community_question&sys_id=3acc1ac61b701910aefc11751a4b...