Creating a standard type change request

Alamelu1
Tera Contributor

I want to create a standard type change request using a transform script

 

In my transform script code to create an change record, i have the below code, 

target.type = "standard";

 

to create a standard type change. But off late, in the recent releases, this code is not being honoured and a normal change request is getting created by default.

 

I tried the below piece of code as well, but it does not help

var chg_model = new GlideRecord('chg_model');
chg_model.addQuery('name', 'Standard');
chg_model.query();
while (chg_model.next()) {
target.chg_model = chg_model.getValue('sys_id');
}

target.type = "standard";

 

I still only get a normal request being created. 

 

Kindly help

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Alamelu1 

 

The reason is, to create standard change , system need the Standard change template first. So from script bring template as well and then put the data. 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Thanks Atulya. How to bring the template in using script?

HI @Alamelu1 

 

I am not a pro or coder but let me give you hint. For standard change first create a standard change template and it need to be approved.

 

Once it get approved then via script call that template and populate the value. 

 

I am sorry , I dont have any script handy for this.

 

Please accept my all answers as helpful and solution accepted as it serve the purpose.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************