Create standard change by applying standard change template using script.

Bharath71
Tera Expert

Hello everyone,

 

I am trying to create a standard change request by using the script below:

 

var change = new GlideRecord("change_request");
change.initialize();
change.type = 'standard';
change.std_change_producer_version = '<sys_id of std template version>';
change.applyTemplate("Test Template");
change.insert();
gs.print('Change ' + change.number + ' created.');

 

Instead of creating a standard change, it is creating a Normal change. Help me with the script.

 

Thanks,

Bharath

1 ACCEPTED SOLUTION

Mike_R
Kilo Patron
Kilo Patron

Are you using Change Models? if so, you will likely need to set that field too.

View solution in original post

3 REPLIES 3

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Please find the script in the below article for the same:-

 

https://www.servicenow.com/community/it-service-management-articles/create-standard-change-request-u...

 

Please mark my answer as correct based on Impact.

@Saurav11 ,

 

Thanks for checking this post. I have tried the script and a normal change was created for the same instead of standard.

 

Thanks,

Bharath

Mike_R
Kilo Patron
Kilo Patron

Are you using Change Models? if so, you will likely need to set that field too.