|
| 1 | +# Hashtag & Mention Extractor for ServiceNow |
| 2 | + |
| 3 | +A simple yet useful **ServiceNow Background Script** that extracts all hashtags (`#example`) and mentions (`@user`) from any text input using regular expressions. |
| 4 | + |
| 5 | +This script demonstrates how to apply JavaScript RegEx in server-side ServiceNow logic to parse, analyze, or extend user-generated text - ideal for text-analysis demos or lightweight automation projects. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## 💡 Example Use Cases |
| 10 | +- Automatically identify hashtags and mentions in **incident comments**, **knowledge articles**, or **survey feedback**. |
| 11 | +- Build internal analytics to track trending topics like `#VPN`, `#email`, or `#network`. |
| 12 | + |
| 13 | +--- |
| 14 | +## 🚀 How to Run |
| 15 | +1. In your ServiceNow instance, navigate to **System Definition → Scripts – Background**. |
| 16 | +2. Paste the script from this repository. |
| 17 | +3. Click **Run Script**. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +## 📦 Reusability |
| 22 | +The logic is **self-contained** within a single function block — no dependencies or external calls. |
| 23 | +You can easily **copy and adjust it** to fit different contexts: |
| 24 | +- Use it inside a **Business Rule**, **Script Include**, or **Flow Action Script**. |
| 25 | +- Replace the sample `demoData` with a field value (e.g., `current.comments`) to analyze live data. |
| 26 | +- Adjust the regex to detect other patterns (emails, keywords, etc.). |
| 27 | + |
| 28 | +This makes it a **plug-and-play snippet** for any ServiceNow application or table that requires quick text pattern recognition. |
| 29 | + |
| 30 | +--- |
| 31 | + |
| 32 | +## 🔧 Possible Extensions |
| 33 | +- Parse live table data (`sys_journal_field`, `kb_knowledge`) instead of static text. |
| 34 | +- Store extracted tags in a custom table for analytics. |
| 35 | +- Schedule a nightly “Top Tags” report with **Flow Designer** or **PA Widgets**. |
0 commit comments