Scheduling Standard Changes using System Definition/Scheduled Jobs

Cirrus
Kilo Sage

Hi,

We have a number of standard change templates that we would like to schedule. However, when you navigate to System Definition/Scheduled Jobs and then select "Automatically generate something (a change, an incident, a ci, etc) from a template", and select a standard change template, the system always generates a normal change record.

I cannot see anywhere where you can add Type = Standard to the Template Definition, nor can I see any other field you could reference in a script to make Servicenow know that this should be a standard change.

Anyone know how we can generate a schedule using this method please

 

Thanks

1 ACCEPTED SOLUTION

Michael Fry1
Kilo Patron

Instead of using Scheduled Job to trigger template, use Scheduled Job to trigger a script and use a script like this:

var change = new GlideRecord('change_request');
change.initialize();
change.type = 'standard';
change.applyTemplate('std_template_name_here');
change.insert();

https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GlideRecord-applyTemplate_String

View solution in original post

2 REPLIES 2

Michael Fry1
Kilo Patron

Instead of using Scheduled Job to trigger template, use Scheduled Job to trigger a script and use a script like this:

var change = new GlideRecord('change_request');
change.initialize();
change.type = 'standard';
change.applyTemplate('std_template_name_here');
change.insert();

https://developer.servicenow.com/app.do#!/api_doc?v=kingston&id=r_GlideRecord-applyTemplate_String

Cirrus
Kilo Sage

Thanks Michael