- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 12:17 PM
Hello,
I need to trigger an activity when a checkbox field on the parent case is checked (on the Kingston version). I am trying to use a script for the trigger condition but couldn't get it to work so far! If someone could help me figure out where I am going wrong, that would be brilliant!
Here's the script I'am using:
(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */,
hrTriggerUtil /* hr_TriggerUtil script include instance */) {
if (current.u_checkbox_case_field == true) {
return true;
} else {
return false;
}
})(parentCase, hrTriggerUtil);
Many thanks in advance!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 12:31 PM
Try something like this in the Advanced Trigger. I am using a mycustom_field value from the parent (Lifecycle Event) case. Be aware that this trigger (Activity Set) will be evaluated on creation of the LE Case.
var gr = new GlideRecord('sn_hr_le_case');
if (gr.get(current.parent)) {
gr.u_mycustom_field = Yes; }
return true;
Regards,
Mike

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 12:31 PM
Try something like this in the Advanced Trigger. I am using a mycustom_field value from the parent (Lifecycle Event) case. Be aware that this trigger (Activity Set) will be evaluated on creation of the LE Case.
var gr = new GlideRecord('sn_hr_le_case');
if (gr.get(current.parent)) {
gr.u_mycustom_field = Yes; }
return true;
Regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 12:54 PM
Hi Mike,
Thanks so much for your prompt response! This script works when I update the checkbox before the LE case moves to 'work in progress' state but not if I update it after.
However, I need this activity triggered not on creation but on change to the LE Case. But I am guessing that isn't possible due to the way activity sets are designed, and as you say the trigger is evaluated on creation and not on change!
Thanks again though, really appreciate your help!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-14-2018 02:26 PM
You are correct, the activity set will not be evaluated on modification of the LE Case.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-24-2018 11:53 AM
Hi Mike
I am trying to use your solution above but it isn't working for me. I have the employee transfer field on the onboarding form mapped to the employee transfer column on the sn_hr_le_case table. Am I missing something?
My form field is a yes/no but it doesn't seem to write to the table which what I think is the problem.
Any help would be very appreciative.
thank you
Jen
(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */,
hrTriggerUtil /* hr_TriggerUtil script include instance */) {
var gr = new GlideRecord('sn_hr_le_case');
if (gr.get(current.parent)) {
gr.u_employee_transfer = Yes; }
return true;
})(parentCase, hrTriggerUtil);