How do I dynamically create the Subject in Client Template to populate based on information from the case?

Randy33
Tera Guru

I am trying to dynamically create the subject of a reply email to populate based on information from the case.

I am using the Email [sys_email] table so I'm able to capture the email chain in the reply.

find_real_file.png

I want the case number as well as the short description from the case to be the subject of the email.  The issue I'm having is because the client template isn't using the table used for the case (using sys_email vs sn_hr_core_case_relations).  Could someone point me in the right direction as to how I would accomplish this.

find_real_file.png

8 REPLIES 8

please add: 

while (gr.next())

{

email.setSubject("your code");

}

Randy33
Tera Guru

I must be doing something wrong as I am unable to get anything to display in the subject area.

Email Notification Script:

find_real_file.png

 

Client Template that calls the script:

find_real_file.png

Do you see any reason why the subject is not populating?

Hi,

Change the content type to "HTML" and then call the mail script as below: Make sure the Subject field should be empty.

find_real_file.pngPlease mark Correct/helpful, if it helps.

Chuck Tomasi
Tera Patron

For what it's worth, we did an episode of TechNow on the Email Client earlier in 2019. Take a look at episode 64.

TechNow Episode List - Developer Community - ServiceNow Community