Using Flow Designer to extract Standard Change Template - Template values?

Happy S
Tera Expert

As per subject, I have followed @Amit Gujarathi  guide in using an Encoded Query script to get the template values out from the Standard Change Template and it worked successfully.

 

But I am thinking of how to apply the encoded query script in Flow Designer? Appreciate if anyone can guide me on this?

 

Thanks to @Uncle Rob I am just getting started going thru your videos and it has been very informative so far..

 

Wondering if you can give me some guidance on this?

 

The script

 

 

var templateValues = (function (templateSysId) {

if (gs.nil(templateSysId)) {
return 'Template does not exist';
}

//Get template record from SysId
var grTemplate = new GlideRecord ('std_change_record_producer');
grTemplate.get(templateSysId);

var templateValueReference = grTemplate.template;

if (gs.nil(templateValueReference)) {
return 'Template values does not exist';
}

var grTemplateValues = new GlideRecord('std_change_template');
grTemplateValues.get(templateValueReference);
  
  
var template = grTemplateValues.getValue('template');
  
var fields = template   
.split('^')
.filter (function (pair) {
  return pair.indexOf('=') >-1;
})

.map(function(pair) {
  return pair.split('=')
})
.reduce(function(output,pair){
  output[pair[0]] =pair [1];
  return output;
},{});
  
  return fields;

})(templateSysId);

gs.info(templateValues);

 

 

 

Thank you !

1 REPLY 1

Uncle Rob
Kilo Patron

I'm sorry I don't have a clear idea of what you're trying to accomplish.