mailto link with both Watermark and Custom Body Text

G24
Kilo Sage

Hello smart people,

 

When one of our HR Cases needs to be approved by a manager, we send out an email that includes the following in the message HTML:

 ${mailto:mailto.approval.hr_case}

 

...clicking on this link will automatically draft an email for the manager, to be sent back to ServiceNow indicating his approval.  When the user clicks on that link, an email is composed with the following subject and watermark:

Subject
     Re:HRC0015443 - approve
Watermark
     Ref:MSG8210004_FThoSGHEsa9jVaJb4kb7

 

But the BODY of the email is blank. And I don't see a way of adding text to the body of the email by modifying sysevent_email_template "mailto.approval.hr_case"

 

I tried adding an "Email layout" to the record, and that also did not work.

 

As an alternative approach, Approach 2, I tried constructing my own "mailto" tag in the body of the HTML, as follows:

 

<a href="mailto:${mail_script:chs_get_sys_prop__sn_hr_core.hr_email}?subject=RE: ${sysapproval} - approve&amp;body=Sending%20this%20email%20will%20cause%20the%20CHS%20Solutions%20Portal%20to%20record%20your%20approval%20for%20request%20${document_id.number}.">Approve instantly via Email</a>

 

...And this works in that it does compose an email draft with the body that I want, however it does not include the necessary watermark, and there seems to be no way to manually generate a watermark like the one that ServiceNow is automatically including via the mail "template".  So this approach is not working when the message gets back to ServiceNow.  (ServiceNow relates the email with the case and not with an approval.)

 

Does anyone know how I can have a link which drafts an approval email back to ServiceNow that includes BOTH custom body text AND a Watermark?  Thanks.

 

Details...

Approach 1 screenshot:

111.png

 

Approach 1 email draft screenshot:

000.png

 

Approach 2 screenshot:

<a href="mailto:${mail_script:chs_get_sys_prop__sn_hr_core.hr_email}?subject=RE: ${sysapproval} - approve&amp;body=Sending%20this%20email%20will%20cause%20the%20CHS%20Solutions%20Portal%20to%20record%20your%20approval%20for%20request%20${document_id.number}.">Approve instantly via Email</a>

  - Resulting email draft will not include necessary watermark.  : (

7 REPLIES 7

I wrote a little mail script to grab the last watermark which was entered into the watermark table, for the appropriate table, in this case "sys_approval_approver", but it grabbed the PRIOR watermark, not the one I needed.  I don't know how to make my script run AFTER the watermark is generated.

Ah oki, and not even the onAfter business rule on the sys_watermark table?

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


G24
Kilo Sage

Per Chat GPT and some trial-and-error, it sounds like there is no reasonable way to do what I want to do, that is, to inject extra text into the Approval Email Draft.  ServiceNow generates the watermarks "behind the scenes" and there is no way to hook into them before the generated emails are actually sent out.  The order of operations is 1) Generate Watermark 2) Send the email out 3) Return control to the developer.