- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 08:11 AM
I have a business rule to move my Incident State from an Awaiting state to an Assigned state if the Incident is Awaiting and the Task State changes.
I put a gs.log('updating INC state','CBT_BR_Task State'); in the Script field to see if the BR is triggered and it does write to the log. However, it does not take the action of changing the Incident state to Assigned.
What could be preventing the state change from happening?
See attached screen shots for Filter conditions and Actions
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2018 04:53 AM
Hi Kimberly,
Please use the below script:
Condition: Add the required conditions related to the task in order to make sure when the script to run:
var inc = new GlideRecord("table_name_of_related_list_table");
inc.addEncodedQuery("parent_field_name=" + current.sys_id);
inc.query();
if(inc.next())//Add while instead of if for multiple child records
{
inc.state = "";//Add the assigned value of state.
inc.update();
}
Regards,
Ram M
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 08:22 AM
Change the BR to before insert/update. If you're changing values on the current object use before, if you're changing values on other records use after.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 08:32 AM
Thanks for the suggestion David. I changed to before and it still did not update the incident state.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 08:38 AM
OK so check that there aren't any conflicting business rules or UI policies affecting that field. Try stripping back all your conditions and just confirming that you can actually change the state using the actions you have set.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-16-2018 08:25 AM
Are you want to run Business Rule when Incident State changes from Awaiting state to an Assigned state? If it is true then remove all other filters except for state.