Create a Standard Change Request using a custom UI action for a particular Standard Change Template

Lavanya Damotha
Tera Contributor

Hi All,

 

I have a requirement to create a Standard Change Request when the "Create change request" button is clicked from a form with a specific Standard change template. Please help me here. Thanks in Advance.

1 ACCEPTED SOLUTION

@Lavanya Damotha 

try this

// Get the standard change template (producer version) record
var stdChange = new GlideRecord('std_change_producer_version');
if (stdChange.get('<sys_id_of_standard_change_producer_version>')) {
    var chg = new GlideRecord('change_request');
    chg.initialize();
    chg.chg_model = stdChange.chg_model;
    chg.type = 'standard';
    chg.requested_by = '<sys_id_of_default_user>';
    chg.std_change_producer_version = stdChange.sys_id;
    chg.short_description = stdChange.short_description; // Manually set
    chg.assignment_group = stdChange.assignment_group;   // Manually set
    chg.service = stdChange.service;                     // Manually set
    chg.service_offering = stdChange.service_offering;   // Manually set
    // Set other fields as needed
    var chg_id = chg.insert();
}

also check this link - response from GBall

Apply Standard Template for Change Request through Script 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

9 REPLIES 9

PujaKar
Tera Contributor

Please check the community link below:

Creating a change template 

If I this helps please mark it correct for future readers.

 

Hi @PujaKar ,
Thank you for the reply, it is not about creating the template. We need to create Standard change request by using the existing standard change template which the user already created.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Lavanya Damotha 

You can create a standard change template from any change by using the “Propose Standard Change” button. This is out of the box (OOTB) functionality, so there is no need to create a custom UI for this.

*************************************************************************************************************
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]

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

Hi @Dr Atul G- LNG ,
Thank you for the reply, it is not about creating the template. We need to create Standard change request by using the existing standard change template which the user already created.

Hi @Lavanya Damotha 

The question is, how are you navigating to the Standard Change template? The best way is to either go to Create New and select the template, or go to All Templates → open the Standard Change templates related list. Then, you need to add a New button there to create a new template.

 

DrAtulGLNG_0-1749811222955.png

 

*************************************************************************************************************
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]

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