We're reclaiming inactive PDIs to keep them available for active builders. Learn what's changing, who's affected, and how to protect your work. Read More

Email Script setSubject

akunk23
Kilo Contributor

I'm trying to set the email notification subject to a requested item number. I can't use just ${number} in the subject field since it pulls the REQ number. What would I need to put after the RITM: to successfully pull the RITM number into the subject field?? The script works when I need to pull the RITM number in the message body. Just not sure how to do it in the subject field. Any suggestions would be great. Thanks

find_real_file.png

1 ACCEPTED SOLUTION

Not applicable

try this.



var num = gr.number;


email.setSubject("View RITM: ?????" + num);



Regards,


Vamsi.


View solution in original post

3 REPLIES 3

Not applicable

try this.



var num = gr.number;


email.setSubject("View RITM: ?????" + num);



Regards,


Vamsi.


I actually tried email.setSubject("View RITM: " + gr.number); and it worked. Your idea also works. Thanks so much!


Hi Vamsi,



I tried using email.setSubject line in client template and it's not working for me. Below is my script, please suggest.





<mail_script>


var str = " This is my subject line";


email.setSubject(str);  




var gr = new GlideRecord('u_test_email');


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


gr.query();


while(gr.next()){


var action = gr.getValue('u_email_action');


gs.info("Action Value:"+action);



if(action == '1'){


template.print("Inside forward");


}



else if(action == '2'){


template.print("Inside Send");


}


}


</mail_script>


find_real_file.png