Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Get values from template

Vinay49
Tera Expert

Hi 

we have a requirement to update the template values through the script.

 

var grTemplate = new GlideRecord('sys_template');
        grTemplate.addQuery('sys_id','2e43edbfdb155428a497574b6896199c');
        grTemplate.query();
        if(grTemplate._next())
            {
                var string = grTemplate.template.toString();
    
// how can we proceed here to get the value of field  & update the value with new.
               
            }
15 REPLIES 15

I hope you have changed the field names as per your form fields ? I just tested this on my PDI and I am able to manipulate template fields.

 

Also, the Sys_id of the template is replaced as per your template.


Please mark this response as correct and helpful if it assisted you with your question.