Has anyone been able to have glide.ui.autoclose.time affect a scoped application?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:28 PM
Hello,
We are trying to have a new application for one of our teams auto close tickets after 3 days, the same way as it does for Incident. We found that this was via the following system property: glide.ui.autoclose.time.
We are not sure this will work on a scoped application. Anyone have any experience doing this?
- Labels:
-
User Interface (UI)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2017 03:39 PM
Autoclose functionality does not depend only on glide.ui.autoclose.time property.
There are 3 pieces of configuration points that make up the auto-close behavior.
Property
The property glide.ui.autoclose.time is used to determine the number of days after a "silent" resolved incident is closed. A "silent" record is a record that has not been updated on any fields. Any update resets the record so that its auto-closure is measured from last updated timestamp.
This record is located at /sys_properties.do?sys_id=d5c26446c0a8011800cdf450892cec2d.
Business Rule
Incident autoclose contains all the code necessary to do the closure. This includes the query for all the incidents in resolved state and a query of all incidents that have not been updated for longer than the "autoclose days." The business rule also sets a few values:
- The value in closed_by field to be the same as resolved_by
- Value in the state field to be closed
- Active to be set to false
This record is located at /sys_script.do?sys_id=d67b8d9ec0a80118008cd8f0f7f92fae.
Scheduled job
Autoclose Incidents calls the business rule every hour to actively search for "silent" resolved incidents. The job is auto-queued to run every hour by default. This job is normally quite quick and does not create excessive strain on the incstance. If you have an extremely high volume of incidents being moved into resolved state, then you may change this to run at a lower frequency or even once a day only.
This record is located at /sys_trigger.do?sys_id=d67e98dac0a8011801393f5054790aa5.
Since business rule and scheduled job will be in Global scope, you will have to customize auto close logic for your custom solution.
Regards,
Sachin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-12-2017 09:48 PM
Hello Carl,
Below is the solution.
1.Create a system property i.e sys_properties.do (Mimic the property in the same way as OOTB property "glide.ui.autoclose.time"
2.Create a scheduled job with the script as. Update the table name/additional add query and property name(Per step1) as per your req
autoCloseTickets();
function autoCloseTickets() {
var ps = gs.getProperty('glide.ui.autoclose.time'); //Here create your own system property and pass the updated name
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);
if (pn > 0) {
var gr = new GlideRecord('PASS TABLE NAME HERE');
gr.addQuery('sys_updated_on', '<', queryTime);
gr.query();
while(gr.next()) {
gr.state = 7;
gr.comments = 'Ticket automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.update();
}
}
}
Reference:
http://wiki.servicenow.com/index.php?title=Adding_a_Property
Creating a Scheduled Job - ServiceNow Wiki
P.S: Please ensure you are in the right scope before doing all the changes mentioned above. Let me know if you have any questions.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2019 02:40 AM
Hi Pradeep-created property and scheduled job-existing cases for application are not updated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-31-2019 08:50 AM
For testing purpose, can you execute the same script via background-scripts(on dev instance) ? Do you see any error message when the script is executed? Also, are you referring to a custom Table from scoped app here?
-Pradeep Sharma