Create a metric on consecutive responses from customer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 11:23 AM
Hello ServiceNow community.
I am a bit new to metrics and not that great with scripting. I am looking to create a metric that would essentially report on consecutive responses from the caller, watcher, and anyone else except for the assigned to.
For example, if three people messaged on a ticket and one of them is not the assigned to agent, then I want a metric that would help me catch those tickets.
I need to do this for incidents and catalog tasks.
All your help and feedback are appreciated. Thank you.
Sam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-23-2024 08:32 PM
Hi @saminsaju
Step 1: Determine the Data Points to Capture
First, define what constitutes a “response” in your context. Common examples include comments added, additional work notes, or status changes. Determine which tables these responses are logged in. For comments and work notes, this might involve the sys_journal_field table.
Step 2: Create a Business Rule
You’ll want to create a Business Rule that triggers on insert or update actions for the relevant response fields in incidents and catalog tasks.
1. Navigate to System Definition ; Business Rules and click on “New” to create a new business rule.
2. Set the Table for the Business Rule to the one housing incidents and another for the catalog tasks.
// If the update is on the comments or work notes fields
if (current.comments.changes() || current.work_notes.changes()) {
var responder = current.sys_updated_by;
var assignedTo = current.assigned_to;
// Check if the responder is not the assigned agent
if (responder != assignedTo) {
// Logic to flag the ticket, could involve setting a custom field
// or incrementing a counter for non-assigned responses
current.u_non_assigned_responses += 1;
current.setWorkflow(false); // prevents rule from triggering itself
current.update();
}
}
Step 3: Reporting
- After setting up the mechanism to capture and perhaps count these non-assigned agent responses, create reports based on this data.
- Navigate to Reports > Create New. Select the table you are tracking (incidents or catalog tasks), and configure your conditions to display records where your new flag or counter indicates the presence of non-assigned responses.
Note: Please Mark this Helpful and Accepted Solution. If this Helps you to understand. This will help both the community and me..
- Keep Learning
Thanks & Regards
Deepak Sharma