- 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:59 AM
Hi
In your inbound action, try this code.
var sysid = email.body.sys.toString();
var gr = new GlideRecord('u_covid_report');
gr.addQuery('sys_id', sysid);
gr.query();
gs.log("Row count is "+gr.getRowCount());
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();
}
Mark the comment as a correct answer and helpful once worked.
- 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.