(Manage Life Cycle Event) Activity Set is not getting triggered using Trigger Type: Advanced
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago - last edited a month ago
Hi All,
I am using advanced trigger type to check if the previous activity set is completed or not using the below script, along with the additional check in HR Profile (Parent Case->HR Profile->Custom Field).
Expectation: If there is a value is the (Parent Case->HR Profile->Custom Field) I am straight away triggering the current Activity Set. If there is no value in the custom field then I am checking weather the previous Activity Set is competed or not. If completed then trigger the Current Activity Set.
var job_check = parentCase.subject_person_hr_profile.u_custom_field.toString();
if(job_check)
{
return true;
}
else
{
var prerequisiteActivitySetIds = ['sys_id']; // SysId of Previous Activity Set
if (!hrTriggerUtil.checkActivitySetsCompleted(prerequisiteActivitySetIds))
{
return false;
}
else
{
return true;
}
}
The above configuration works when there is a value in the Custom Field it straight away trigger the current Activity Set and did not check if the previous activity set is completed or not. However when there is no value in the Custom Field, then even the previous Activity Set is completed the current Activity set is not getting triggered.
I also tried to just check the dependency on the previous activity set through script using below code but it didn't work. I have also cross check the sys_id of the previous activity set but still it's causing an issue.
var prerequisiteActivitySetIds = ['sys_id']; // SysId of Previous Activity Set
if (!hrTriggerUtil.checkActivitySetsCompleted(prerequisiteActivitySetIds)){
return false;
}
else{
return true;
}
Thanks in Advace!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @Rohit_Singh_19 ,
You can use the below code :
var job_check = '';
if (parentCase && parentCase.subject_person_hr_profile && parentCase.subject_person_hr_profile.u_custom_field) {
job_check = parentCase.subject_person_hr_profile.u_custom_field.toString();
}
if (job_check) {
return true;
}
var prerequisiteActivitySetIds = ['actual_sys_id_here']; // Replace with real sys_id
if (!hrTriggerUtil.checkActivitySetsCompleted(prerequisiteActivitySetIds)) {
return false;
}
return true;
Sandeep Dutta
Please mark the answer correct & Helpful, if i could help you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
Hi @Rohit_Singh_19,
Did you try to put in into a function?
Example:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
The issue which I have observed is that when I tested only for 1st Activity Set dependency through script then also the code not working as expected. I did used gs.info to debug in script section and every time I am getting a false value even my first task is completed. When I use Trigger Type - Other Activity Type (1st Activity Set) then it works fine.
I have already cross checked the sys_id of 1st Activity Set.
In the HR Case after closing the 1st task I did check the Activity Set Contexts UI Action the first step show in finished state.
Is there any possible issue which is causing the issue?
Thanks
