Create a change request through Script

Reena Kumari2
Tera Contributor

Hi Team,

My requirement is to create all 3 types of change through background script. Please advice on this.

 

Thanks&Regards

Reena Kumari

1 ACCEPTED SOLUTION

 

I got the issue, chg_model value was missing, try below:

Emergency:

var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'emergency'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
chg.insert(); 

 

Standard:

var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'standard'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='e55d0bfec343101035ae3f52c1d3ae49';
chg.insert();


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023

View solution in original post

8 REPLIES 8

 

I got the issue, chg_model value was missing, try below:

Emergency:

var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'emergency'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
chg.insert(); 

 

Standard:

var chg = new GlideRecord('change_request');
chg.initialize();
chg.type = 'standard'; // replace if you want to create another tupe of change;
chg.short_description = "test"; // replace for any other short desc;
chg.chg_model='e55d0bfec343101035ae3f52c1d3ae49';
chg.insert();


Please mark the answer correct/helpful accordingly.


Raghav
MVP 2023

Hi Raghav,

Is there any way to create standard and emergency change request without models. As we are not using models in our project.

Thanks

Reena Kumari

Model is required because, when I tried without models, it did not work


Raghav
MVP 2023

chg.chg_model='62d10fa1c303101035ae3f52c1d3aec1';
chg.chg_model='e55d0bfec343101035ae3f52c1d3ae49';

 

what is the value you are assigning to chg_model, from where you got this value ?