How to get Task number in subject line for email notification.

Saridha_L1
Tera Expert

Hi Team,

I have configured an email notification on RITM table,would like to populate Task number in notification subject.There is an existing post , I could not find an answer. So please help me.

 

Regards,

Saridha.L

1 ACCEPTED SOLUTION

Shishir Srivast
Mega Sage

as everybody already informed, you need to use email API setSubject to set the email subject with task number but just wanted to add one thing here is, setSubject will replace the whole email subject so if you want to put Task number along with other other email subject content then you can use the code provided by bhagya1764 by updating the below line of code.

email.setSubject(gr.number + ' : ' + 'YOUR REST OF THE EMAIL SUBJECT TEXT');

View solution in original post

7 REPLIES 7

Bhagya Lakshmi
Mega Guru

Hi Saridha,

You will write Email script for getting Task number use following code

find_real_file.png

Then use this email script in your notification like this.

In body

${mail_script:<your mailscript name>}

 

Thanks and Regards,

Bhagya Lakshmi

 

luffy3478
Tera Guru

 

To display a catalog task write below script in email notification script and add the script in the notification BODY.

var gr=new GlideRecord("sc_task");

gr.addQuery("request_item",current.sys_id);

gr.query();

if(gr.next()){

email.setSubject("Task Number"+gr.number);

}

 

The above script will only display single catalog task.

Shishir Srivast
Mega Sage

as everybody already informed, you need to use email API setSubject to set the email subject with task number but just wanted to add one thing here is, setSubject will replace the whole email subject so if you want to put Task number along with other other email subject content then you can use the code provided by bhagya1764 by updating the below line of code.

email.setSubject(gr.number + ' : ' + 'YOUR REST OF THE EMAIL SUBJECT TEXT');