run a business rule (2) after a business rule (1) has run
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2023 02:35 PM
Hello,
So, when technicians submit a task (or create a task from an Incident), the following Business Rule runs (Before).
(function executeRule(current, previous /*null when async*/) {
var grSecurityIncident = new GlideRecord('sn_parent_incident');
if (grSecurityIncident.get(current.parent) && grSecurityIncident.getValue('assignment_group') && grSecurityIncident.getValue('assigned_to')){
current.assignment_group = grSecurityIncident.getValue('assignment_group');
current.assigned_to = grSecurityIncident.getValue('assigned_to');
}
})(current, previous);
Now, it only runs if the parent ticket assignment group and assign to are NOT empty.
I want to create another business rule that will run after the script above which will re-assign the ticket to a different group and remove the assign to the field. before most of the tickets contain a specific Short description, I was going to say: IF ..... has the following short description... run the following:
Do you know if that is what I should do?
This is the logic:
- The technician has an incident, and he will create a task (child)
- After the technician presses submit on the task, the script above will run.
- The new task ticket will contain the Assignment Group and the Technician's name.
I want the new script to change the assignment group to a different group, and remove the assign to person.
I hope it makes sense.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2023 03:01 PM
Hi,
You can use the "Order" value on the business rule definition, to control the order of execution. So set that accordingly when defining a business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2023 03:31 PM
@AngelP83 Just adding on here for clarity, the business rules will run from lowest order value to highest order value. This comment goes into more detail if you would like further clarification.
Ex:
BR1 with an order value of 100 will run before BR2 with an order value of 200
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2023 05:24 PM
Thank you!!!
So, if I create a new script with Order 99 (The script I added previously has Order 100). The new script will run and it will avoid the Script 1, right? As long as the criteria is met of course.
Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2023 06:00 PM
It will still run script 1 if the criteria for script 1 (order of 99) are met. However, it will run script 2 (order of 100) after script 1 finishes executing.