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

Michael Kaufman
Giga Guru

Jim,

I think you would need to query the sys_watermark table with the source_id field. However, that watermark number maybe not be stored until after the notification is formatted, which would cause issues in writing that script.

Mike


Found out that you can actually use...



email.watermark



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


I have just written and am in final testing of an ebonding process via email


A few script includes, modification of inbound actions and a business rule.



It has a script include for each 3rd party you will work with - simply called via any inbound action It gets a reference number, watermark, an option to drop, special functions (close, resolve etc)



I also have a rewritten routine to process any email using results from the above if found or the main email. Any notifications going out are event driven so there is a business rule that is used for each 3rd party.


I also have another Script Include to allow for really long condition lists (I did not fancy increasing the size incase something else breaks).



One of the companies I am testing with sends us an email response and we extract their ticket reference, but to reply we must use their "reply to" address - aka, their watermark.



The only issue I have at the moment is on the watch and work_notes list. We add the user which has their main "support@....." address, but if we send to this it creates a new record.


I am thinking of creating a BR or similar that will check each list and if the company appears, remove it and add the watermark address instead.



I can send up the document I have already written that covers most of this at some stage next week. Cheers


Thanks Jim, as always!



Your solution worked for me. I was able to insert email.watermark into a template.print() statement which adds a hyperlink to the notification that includes a mailto: line formatted with a subject line and body text. I inserted the watermark into the subject line so that it would be properly processed by an inbound email action.