Activity Set - Advanced Trigger Condition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 06:02 AM
Hello everyone,
We have this requirement to set trigger condition for one of our activity set.
Activity set only trigger when variable(u_sipr_email_required) is answered yes.
New to Dev, here is my script below
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 06:08 AM
the variable 'u_sipr_email_required' is within a HR task, should I dot walk from the parent case within the script?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-16-2024 06:21 AM
@Averyy Here is an example script where we are looking for the start date, an email address being populated and a previous activity set is completed. I hope this gives additional insight on how you can do this for your use case.
(function shouldActivitySetTrigger(parentCase /* GlideRecord for parent case */,
hrTriggerUtil /* hr_TriggerUtil script include instance */) {
var employeeStartDate = parentCase.subject_person_hr_profile.employment_start_date;
var employeeCorporateEmail = parentCase.subject_person.email;
var prerequisiteActivitySetIds = ['20f7a984ecb61300964fb378c82f556f'];
//Check Corporate Email is populated
if (gs.nil(employeeCorporateEmail))
return false;
//Check Employee Start Date is populated and is on or before today
if (gs.nil(employeeStartDate) || !hrTriggerUtil.checkForElapsedDate(employeeStartDate.getDisplayValue()))
return false;
//Check Previous Set has finished
if (!hrTriggerUtil.checkActivitySetsCompleted(prerequisiteActivitySetIds))
return false;
return true;
If my answer has helped with your question, please mark my answer as an accepted solution and give a thumbs up.
Regards,
Mike
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 05:59 AM
I have question related to checkActivitySetsCompleted function. The prerequisiteActivitySetIds will the sys_id of the previous activity set ?
if (!hrTriggerUtil.checkActivitySetsCompleted(prerequisiteActivitySetIds))
return false;

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2024 06:28 AM
@bhavishapadia Yes, the sys_ID of the previous Activity Set