How do we select the standard change template from Flow designer?

switypatel
Giga Contributor

How do we select the standard change template from Flow designer? When I select action as Standard change request it says it will take the template associated to Catalog. Seems like its not working.

12 REPLIES 12

The below worked for me. 

I provided an incorrect template name earlier that is the reason, the standard change that was created was empty.

The associated tasks in the standard template didn't show up as I missed to add the version before the applyTemplate(). Once done it worked like charm. 

 

(function execute(inputs, outputs) {
// ... code ...
var change = new GlideRecord("change_request");
change.initialize();

//Change version should be mentioned to add the pre-defined tasks associated with the standard change
change.std_change_producer_version = "e8f8b2bc1b93a450cfaaabbb999cccde";
change.applyTemplate("My Standard Template Name");
change.type = 'standard';
change.insert();

// outputs.change_number = change.number
outputs.change_ref = change

})(inputs, outputs);

blairf
Giga Expert

@switypatel did you find the answer?  I'd like to know too.

I don't know if still interested, is an old topic, but for future people searching the same, I think this other community entry can be useful to select the template in flow designer without the custom script: https://community.servicenow.com/community?id=community_question&sys_id=0a337b7cdb2aa410ab0202d5ca96...

In his answer, Kieran sais he use two actions, first action to lookup the required change template from the Change Template Version table, and a secondary action to create a change request using that record.

Hope that helps