- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 12:37 PM
Hi All,
I'm new to world of service now and was looking for assistance on a business rule.
I'd like to make is to a priority 2 incident is raised to priority 1 eight hours after being raised/opened as a p2. I've tried many different tests within business rules but nothing seems to work (We are on Fuji)
When to run
When: Before
Order: 100
Filter Conditions
Active is true
Priority is 2 - High
Duration is Days 0 Hours 8
Actions
Urgency to 1 - High
Impact to 1 - High
Priority to 1 - Critical
The closest out of the box business rule is Incident State Active on Assignment which I've been playing around with a bit as well. Can someone offer some advice?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-25-2016 01:42 PM
Change of approach. I built the list filter to get it the way I wanted, then copied the query and used it in the addEncodedQuery() method like this.
var inc = new GlideRecord('incident');
inc.addEncodedQuery('active=true^priority=2^sys_created_on<javascript:gs.hoursAgoStart(8)');
inc.query();
gs.log(inc.getRowCount() + ' records found');
while (inc.next()) {
inc.priority = 1;
inc.update();
}
I did not update your scheduled job or records.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 02:27 PM
This is great, thank you for the support
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 06:15 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 06:24 AM
Hi David,
Before I run anything in a scheduled job, I always test in scripts background. Have you tested there?
Also, if you add the line:
gs.log(inc.getRowCount() + ' records found');
right after the "inc.query();" line, it will output how many records it plans to update. That should help diagnose any potential issues. Comment that out in your scheduled job before it goes in to production however.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 08:56 AM
Hi Chuck,
Its very odd, the background script shows no records are found. There are P2's in the system (I've double checked that)
I've been comparing this code I've found online such as in Change Urgency to High if User is VIP - ServiceNow Wiki Would this code not need to call some sort of IF statement to check the fields?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 08:59 AM
The database is doing the field checking with the various query lines. I'll try to take a look at it in a bit.