Show catalog item name in the e mail subject

sreejith05
Giga Expert

Hi All,

I wanted to display the catalog item name in all the service now email alerts, how can i do the same?

Please note i wanted to add this for approval request email, request submitted email, request assigned e mail etc. (need to get the value ir respective of tables)

1 ACCEPTED SOLUTION

Gowrisankar Sat
Tera Guru

Hi Sreejith,



Make use of Mail Script setSubject function:



email.setSubject("This is the new subject line");



http://wiki.servicenow.com/index.php?title=Scripting_for_Email_Notifications#gsc.tab=0


View solution in original post

8 REPLIES 8

Gowrisankar Sat
Tera Guru

Hi Sreejith,



Make use of Mail Script setSubject function:



email.setSubject("This is the new subject line");



http://wiki.servicenow.com/index.php?title=Scripting_for_Email_Notifications#gsc.tab=0


Gowrisankar Sat
Tera Guru

For Approval Table:


The Subject Line should be: Requested Item ${sysapproval} Approval Request for ${sysapproval.item.name}



For Catalog Task Table :


Catalog Item ${request_item.cat_item}: ${number} has been assigned to group ${assignment_group}      



For Requested Item Table :


Catalog Item ${cat_item}: ${number} has been Requested.



For Request Table(only one catalog item per request):



Create a mail script and use this code:



var gr = new GlideRecord('sc_req_item');


gr.addQuery('request',current.sys_id);


gr.query();


if(gr.next())


{


email.setSubject("This is the Request for" + gr.cat_item.name);


}


for approver table it should be ${sysapproval.cat_item.name}


Thanks Gowrisankar you are really amazing this detailed explanation saved my hours of work.