|
| 1 | +# Outlook Email Watermark Utility for ServiceNow |
| 2 | + |
| 3 | +# Overview |
| 4 | +This reusable utility allows users to send emails **outside ServiceNow** (e.g., using Outlook or any default mail client) while still maintaining the conversation within ServiceNow. |
| 5 | +By embedding a unique watermark reference, any replies to the email will automatically append to the original record's activity feed. |
| 6 | + |
| 7 | +This helps teams collaborate externally without losing internal record visibility — ideal for customers or vendors who communicate via Outlook. |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +# Objective |
| 12 | +- Enable ServiceNow users to send Outlook emails directly from a record. |
| 13 | +- Maintain conversation history in ServiceNow using watermark tracking. |
| 14 | +- Make the solution **generic**, reusable across tables (Incident, Change, Request, etc.). |
| 15 | +- Prevent dependency on outbound mail scripts or custom integrations. |
| 16 | + |
| 17 | +# Components |
| 18 | + |
| 19 | +## 1. Script Include: GenericEmailUtility |
| 20 | +Handles the logic for: |
| 21 | +- Constructing the mailto: link. |
| 22 | +- Fetching recipient and instance email addresses. |
| 23 | +- Generating or retrieving the watermark ID. |
| 24 | +- Returning a formatted Outlook link to the client script. |
| 25 | + |
| 26 | +## Key Methods |
| 27 | +1. get_Outlook_link() - Builds the full Outlook mail link with subject, body, and watermark. |
| 28 | +2. getWatermark(record_id, table_name) - Ensures a watermark exists for the record. |
| 29 | +3. getEmail(user_id) - Fetches the email address for the target user. |
| 30 | + |
| 31 | +## 2. UI Action (Client Script) |
| 32 | +Executes on the record form when the button/link is clicked. |
| 33 | +It gathers record data, constructs a payload, calls the Script Include using GlideAjax, and opens Outlook. |
| 34 | + |
| 35 | +## Key Steps |
| 36 | +1. Collect field data like requestor, short description, and description. |
| 37 | +2. Pass record details to the Script Include (GenericEmailUtility). |
| 38 | +3. Receive a ready-to-use Outlook link. |
| 39 | +4. Open the mail client with prefilled details and watermark reference. |
| 40 | + |
| 41 | +## How It Works |
| 42 | +1. User clicks "Send Outlook Email" UI Action on a record. |
| 43 | +2. Script gathers record data and passes it to GenericEmailUtility. |
| 44 | +3. The utility builds a 'mailto:' link including the watermark. |
| 45 | +4. Outlook (or default mail client) opens with pre-filled To, CC, Subject, and Body fields. |
| 46 | +5. When the recipient replies, ServiceNow uses the watermark to append comments to the correct record. |
| 47 | + |
| 48 | +## Example Usage |
| 49 | +**User clicks “Send Outlook Email”** on a Request record: |
| 50 | +Outlook opens prefilled like this: |
| 51 | + |
| 52 | +<img width="288" height="65" alt="image" src="https://github.com/user-attachments/assets/b58c5e0a-d80a-40ca-9ab5-f188a1203169" /> |
| 53 | + |
| 54 | + |
| 55 | +<img width="710" height="496" alt="image" src="https://github.com/user-attachments/assets/5cbc7645-4233-4826-99f7-e2948bb5ab78" /> |
| 56 | + |
0 commit comments