Can I apply a variable in an Incident or Change template?

stb2
Kilo Contributor

Hello,  

 

I was wondering if it is possible to apply variables in a certain template?

In detail, that would mean for e.g  solving an Incident I create a template with the appropriate state and so on.

Then I would like to fill in the field Additional Comments with the text:

Dear "CALLER"  

We have resolved the incident.

 

And Caller should be the name from the current record.

 

Is this possible somehow?

2 REPLIES 2

anurag92
Kilo Sage

Yes it is possible with client scripts.



So, if you change the state to: Resolved - you can auto-populate comments as using onchange client script.




function onChange(control, oldValue, newValue) {

      if (oldValue == newValue)


              return;


if(newValue == '6')
{
var caller = g_form.getValue('caller_id');
var str = "Hello"+caller+" We have resolved the incident.";
str = String(str);
g_form.setValue('comments', str);
}



}



Let me know if this helped


RajNow
ServiceNow Employee
ServiceNow Employee

Hi Stefan, you may check the below post for similar query.



Incident Templates - using variables to customize comments - ServiceNow Express Support