Skipping Activity Sets Based on Parent Case Information
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 11:33 AM
Once the request is approved by a manager, we have 3 different sets of documents that must be accepted by the employee, but only 1 applies for each case depending on data on that specific case (based on answers in the Record Producer). We want to skip the other 2 that do not apply to that specific case.
I have an advanced Trigger script setup that checks that the approval Activity set is completed by the manager AND checks to see if the data matches what is required for the documents and it is working. However, how do you tell the Activity set to skip because it is not actually required based on the data on the case? That is where we are stuck at the moment. They just sit there waiting.
Unless I'm mistaken, I can't really use Audiences because they do not look at a specific Case in order to return true or false. And we can't really do it via scripting because we don't have any link to the parent case, do we? It was originally setup to use an Audience and it queried the open cases, but there could be multiple cases, which is causing the employee to get multiple docs to sign/accept.
Again, if I'm not mistaken, I need the condition on the Activity Set itself (context is linked to the case) and not the individual Activities (linked to User).
- 1,726 Views
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-03-2024 08:19 AM
Have you came accross something where you - Activity set C is dependent on activity set b, but B gets skipped. And then C does not trigger. How do you recommend we handle this? Audience criteria isn't an option here is as well
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-21-2023 05:30 AM
Rahul:
As I remember, the lifecycle workflows keep evaluating the conditions of each activity set "awaiting trigger" to see if those have been fulfilled. Remember that the evaluation is done based on the evaluation interval (usually set to 4 hours by default. And, after keep evaluating for long time, the workflows assumes that the activity set has reached an error, thus setting the state to Error. There's definitely something ServiceNow should add as functionality to lifecycle events (unless is been already done). I'm not working currently with the HRSD module, but what I'd probably try is to set a new custom set, similar to the "skipped", and maybe set the activity set from "awaiting trigger" to that custom state, hoping that the activity remains visually in the HR case flow, while not getting the error state. Good luck.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 12:43 PM - edited 04-14-2023 12:44 PM
Hello, I found your article something similar to my case.
If 'A' Activity Set is triggered and in "Running Activities" state , then I don't want to have B or C activity sets with condition "awaiting trigger" should trigger at all even if I have few "Parent case Opened for" templates added in all activity sets.(Those B& C activity sets have nothing to do with the flow I run and are useless)
Can you please let me know if you have any BR or specific script to achieve this.
Posted the below question in community where you get the detailed explanation of issue.
@JV2 @Jim Coyne @Susan Britt @Community Alums

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-14-2023 01:41 PM
Hi,
You are correct that audiences may not be the best approach in this case, as they don't provide a way to evaluate conditions specific to a particular case.
One approach you could take is to use a before query business rule on the activity set table. This rule would fire whenever an activity set record is queried (e.g. to show it on a list or form), and you could modify the query to exclude activity sets that are not relevant for the current case.
In the business rule script, you could retrieve the current case record using current.parent (assuming the activity set is a child of the case record), and then check if the specific document is required based on the data in the case record. If the document is not required, you can modify the GlideRecord query to exclude the activity set record. Here's an example of what the business rule script might look like:
(function() {
// Get the current case record
var caseGr = new GlideRecord('table_name');
if (caseGr.get(current.parent)) {
// Check if the document is required based on the data in the case record
if (!caseGr.getValue('document_required')) {
// Modify the query to exclude the current activity set record
current.addQuery('sys_id', '!=', current.sys_id);
current.query();
}
}
})();
Thanks,
Rahul Kumar
Thanks,
Rahul Kumar