Retrieving the watermark reference # from mail_script

Jim Coyne
Kilo Patron

Is it possible to retrieve the watermark reference # on the notification through mail_script code? I need to generate a link in the notification that, when clicked, will generate a reply email with the watermark reference # from the original email for the inbound action to work properly.

I cannot use a "mailto:" template for this because the reply email address may not necessarily be instancename@service-now.com. The reply address depends on the user's company. I can build the proper link if I can retrieve what the watermark reference # will be for the notification.

1 ACCEPTED SOLUTION

Found out that you can actually use...



email.watermark



...within some mail_script code to get the watermark.


View solution in original post

17 REPLIES 17

Hi Jim,


Could you please share the code snippet for the same, even i am trying to accomplish the same task.


On click of a link , opening a mailto: with watermark in it.


But i am not able to pass the value as it is not getting stored in a variable to pass it further, though it gets printed by using template.print in the original email.



Below is the code i tried..


====


template.print("watermark:"+email.watermark); // --- this code prints the watermark correctly in the email body


var watermark = email.watermark;


template.print(watermark); //---this code prints 'undefined'


var email = "xyz@xyz.com";


var subject = "Feedback&body=Thanks for the feedback.This is an autogenerated email"


var url1 = '<a href="mailto:'+email+'?subject='+subject+watermark'">'+'<img src="emoticon_angry.png" />'+'</a>'; //-- prints undefined for the watermark part in the mail popup


template.print(url1);


====


Hi Ashwani,


Here is a code sample that is similar to what I used in the email notification. The actual code contains proprietary information from my client, so for obvious reasons I can't include it here.



<mail_script>


  template.print('<center style="color:#ffffff;"><span class="btn-success"><a href="mailto:' + gs.getProperty("instance_name") + '@service-now.com?subject=Re: Scrum Testing Task - passed (' + email.watermark + ')&body=Please provide any details for Scrum Testing Task ' + gr.number + ' in the body of your email." style="border-color:#009341; background-color:#009341;">Pass</a></span></center>' + '\n');


</mail_script>



I assume you wrapped the code you're using inside a set of mail_script xml tags. I haven't tried getting the watermark from an email and assigning it to a variable, so I can't comment on why that might not be working for you.


James... would you mind sharing your code?   I'm trying to do something similar.   Thanks!


Hi Kim,



Please refer to my earlier reply in this thread to Ashwani S, in which I shared a code snippet.


Hi,

Can you please help me with the inputs, I am having same requirement.