- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 01:36 AM
Hi All,
I am using client template and trying to add a "Fw:" prefix in Subject line using below code. However, below line of code is breaking my script and not overriding the subject. Any suggestions?
email.setSubject("Fw:"+ current.short_description -- current.number);
Below are my script and screenshot for reference.
<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>
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 03:52 AM
Sorry KS, you are correct, the set subject does not seem to work for email clients, I was testing with a normal notification.
I don't have a solution for that yet, lets wait and see if someone else has an answer, I will also keep looking to see if I can find a way.
Cheers,
Diogo
edit: One way that should work, if you create a field in the form (hidden) and you use ${name_of_field} in the subject it should get the same result, you just have to construct the full subject in that field and then use it in the email client.
You can even do the following have a new field called something like u_forward (string) and then use a business rule to evaluate the conditions and if they are true add the text "Fw:", then in the email client subject you can have " ${u_forward) ${short_description} -- ${number} " , if the u_forward is empty it won't be shown and if it has something it will show. I didn't test this but in theory it should work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-16-2017 03:52 AM
Sorry KS, you are correct, the set subject does not seem to work for email clients, I was testing with a normal notification.
I don't have a solution for that yet, lets wait and see if someone else has an answer, I will also keep looking to see if I can find a way.
Cheers,
Diogo
edit: One way that should work, if you create a field in the form (hidden) and you use ${name_of_field} in the subject it should get the same result, you just have to construct the full subject in that field and then use it in the email client.
You can even do the following have a new field called something like u_forward (string) and then use a business rule to evaluate the conditions and if they are true add the text "Fw:", then in the email client subject you can have " ${u_forward) ${short_description} -- ${number} " , if the u_forward is empty it won't be shown and if it has something it will show. I didn't test this but in theory it should work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2020 12:03 AM
Year 2020 and this functionality is still not working.. (Orlando)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-26-2020 05:03 AM
This functionality isn't yet available but I found an Idea in the idea portal that could use some upvoting for it - https://community.servicenow.com/community?id=view_idea&sysparm_idea_id=4fd696bddba444100be6a345ca96...