Inbound action - getting the watermark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2017 12:51 PM
I have an interesting situation.
I need to know the watermark of an incoming email.
The below code shows that it does actually find my Ref:MSG### in the email.
if (email.body_text.indexOf(/Ref:MSG\d+/gi)) {
gs.log('found watermark');
}
However, my watermark is empty and the entire line refuses to print. I have a feeling it's because the email.body_text is encrypted and is preventing me from getting the value?
var foundMark = email.body_text.match(/Ref:MSG\d+/gi).toString();
gs.log("Watermark is: " + foundMark); // Nothing prints, not even the "Watermark Is";
I tried the obvious gs.log(email.watermark) but that didn't work. My end goal is having the watermark stored in a string so I can do some additional processing on it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2017 03:12 PM
How about reverse engineering it? If you know the record you are using (eg. Incident INC0010020) or you have the current.sys_id, you could get the watermark from the sys_watermark table based on the source_id of the record you got.
Example:
var wm = new GlideRecord('sys_watermark');
if (wm.get('source_id', current.sys_id))
gs.log('your watermark is ' + wm.number);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-12-2017 01:44 PM
That only works though if 1 type of notification has been triggered off that record though. It'd be extremely helpful to know what type of notification that the user is replying to.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2023 06:41 AM
Having the same problem, did you eventually managed to get this working?
I know when it is a reply mail the email.body_text is stripping the previous reply content, so also the Ref:MSG on the bottom, that is why it is not in the email.body_text.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-30-2024 01:06 AM