- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2019 02:38 PM
Hi.
I'm working with Change application and currently on London.
Ultimately my goal is to differentiate the state of Change Tasks for Change Requests that are approved vs. not approved yet. When users see Change Tasks in their queue, they don't have visibility into whether the Change Request is approved yet and therefore the user can go ahead and complete their task.
I'm open to any suggestions on how to accomplish the above, but my potential approach is the following:
1) Create a Business Rule to set all new Change Tasks to 'Pending' state (with the condition that the Change Request state is New, Assess, or Authorize).
2) When a "Change Request" is approved, I want to update the state for all "Change Tasks" within a CHG to a different state, e.g. Open. I tried creating a business rule with the following: Table=Change Task; When to run Filter Condition: "Change request.state 'changes to' Scheduled; Action: set "State" to Open
My first BR above worked fine, but the second BR did not. 😞 I thought about adding a 'Set Value' to the workflow, but that seems to only function by updating values on the Change table and not the Change task table, plus there can be multiple change task records.
Please send any suggestions on how to accomplish this.
Thanks!!
Sarah
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2019 05:09 PM
That's ok, I didn't mention that I didn't test the code and my first attempt almost always contains typos!
I've read your questions again and modified the code a little bit.
Your previous rule didn't work because you have specified the trigger table as change task, but the trigger table is in fact change. See below:
Business Rule
Table: Change Request
When: After
Condition: State 'changes to' Scheduled
// Query all active change tasks of change
var OPEN = 1;
var childChangeTask = new GlideRecord('change_task');
childChangeTask.addQuery('change_request',current.getValue('sys_id'));
childChangeTask.addActiveQuery();
childChangeTask.query();
// Loop through all changes and update
while (childChangeTask .next()){
childChangeTask.state = OPEN;
childChangeTask.update();
}
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2019 04:30 PM
Thanks for your input Harish!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2019 04:28 PM
Thanks so much Paul! Worked like a charm!