Set the subject with a mail script on an email notification.

Madhumita3
Kilo Contributor

Hi All,

I have a requirement of setting up a value on the notification subject line with Capitalization. 

Example: Case number Status Changed to [State]

When I am trying to fetch the value of the State field using ${state}, i am getting the field value which is stored in small, for example "idd". I need the value to be displayed as "Idd". How can i achieve this?

Appreciate your help on this.

Thanks in advance.

4 REPLIES 4

Tony Chatfield1
Kilo Patron

Hi, if you want to capitalise the first characture of a string you probably need soemthing like

var myString = 'test'
var myNewString = myString.charAt(0).toUpperCase() + myString.slice(1);

gs.info(myNewString);

Brian Bouchard
Mega Sage

To add to Tony's response, actually setting the subject would be something like:

email.setSubject(myNewString);

Mohit Yadav
Tera Expert

Use Below in email script

email.setSubject(“your subject goes here”);

 

Then call your email script in email body

${mail_script:name of mail script}

 

Please mark Correct & Helpful, if applicable. Thanks!

Madhumita3
Kilo Contributor

It is working for me. Thank you all.