- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:31 AM
Hi All,
i hope u r all ok.
Here is the situation
some times where approval via email is required, i use an email template and i call it in the message HTML area of the notification as follows: ${mailto:mailto.approved}. When the approver clicks on the link a new email is created which includes the REF number. Finally, an inbound action reads the received email and identifies the ticket by the ref code.
Problem
i would like to call the mailto.approved template from an email script and i have no idea how to.
would you know how to do this?
Optionally, in the email script i use the following code:
template.print('<a href="mailto:' + inst + '@service-now.com?SUBJECT=' + 'List of Close Contacts Informed' + '&body=sys:'+ current.sys_id + '">Click here after contacting ALL close contacts</a>');
unfortunately, when i click on the link the new email does not includes the REF code. However, i added to the body of the email the sys_id of the record but the inbound action won't work.
var sysid = UserSsysid(email.body.sys);
var gr = new GlideRecord('u_covid_report');
gr.addQuery('sys_id', sysid);
gr.query();
if(gr.next()) {
gr.u_list_informed = true;
gr.comments = "reply from: " + email.from + "\n\n" + "updated via email by " + gr.u_manager;
gr.update();
}
would you know why this code wont work neither?
regards,
max
Solved! Go to Solution.
- Labels:
-
Notifications
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 05:08 AM
Hi All,
thanks for your responses. Unfortunately, they did not work for me.
In order to solve the issue, i had to change the strategy a bit as per the following.
In the email script
I searched in the sys_watermark for the highest ref number for the specific ticket number and added it to the href. Also, made the subject to be a RE: (reply)
template.print('<a href="mailto:' + inst + '@service-now.com?SUBJECT=' + 'RE: List of Close Contacts Informed' + '&body='+ wnum + '">Click here after contacting ALL close contacts</a>');
In the inbound action
changed to be a "reply" and use current values as i now have the watermark in the email.
Thanks to everyone for your time and help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:39 AM
have you defined the mailto in template module. ?
instead of including via mail script you can define in your template.
Please check my blog , i had created for some update using mailto and inbound action.
https://community.servicenow.com/community?id=community_blog&sys_id=c248e709db191c106064eeb5ca9619a1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:50 AM
thank you very much for your quick response.
the mailto template's name is "mailto.signedoff"
the example you provided i had it done already and it is different to what i am trying to achieve.
thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:55 AM
sample eg:
var ThisServer = gs.getProperty('instance_name') + '@service-now.com?subject=List of Close Contacts Informed';
var RefID = email.watermark;
Here make the changes based on your need.
Sample example:
template.print('<p><p style="font-family: calibri; font-size: 14.5px"><a href="mailto:' + ThisServer + current.sysapproval.getDisplayValue() + ' - approve&body=' + RefID + '%20" target="_top"><b>I Approve</b></a></p>');
template.print('<p><p style="font-family: calibri; font-size: 14.5px"><b>If rejecting using the link below, </b>please remember to provide comments explaining the reason for the rejection in the body of the message.</b></p>');
template.print('<p><p style="font-family: calibri; font-size: 14.5px"><a href="mailto:' + ThisServer + current.sysapproval.getDisplayValue() + ' - reject&body=My reason for rejection follows >>> ' + RefID + '%20 target="_top"><b>I Reject</b></a></p>');

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-12-2021 12:40 AM