- 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-19-2018 09:35 AM
There doesn't appear to be any. I looked in both the set field values and the script column for anything changing the state. Only one sets the incident to closed if it is resolved.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2018 05:25 AM
Thanks so much for your suggestion and patience with me. On a fresh day, I compared your code to mine and found a discrepancy. Your code does work for me.
Where you are using inc.state = "3"; I am using inc.state.setValue(3);
I'm not sure why setValue doesn't work, but I'm happy that your code has made my BR work.
Thanks again.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-16-2020 05:23 AM
Creating a BR on Catalog Task table.