Automated Email from Incidents( P1 and P2) based on Distribution Lists recored on the Incident

ratnasekhar
Tera Contributor

We have a requirement to record a Distrubution List on P1 and P2 Incidents and would need to understand what  is the best way to implement this.

Automated emails need to be sent to the Distrubution list from ServiceNow

9 REPLIES 9

Tanushree Maiti
Tera Patron

Hi @ratnasekhar 

 

Automated emails for P1/P2 incidents can be sent by creating an event in a Business Rule (triggered by insert/update) which then triggers a Notification.

For distribution lists, use gs.eventQueue to pass the email addresses or a group ID to the notification, rather than hardcoding in the Business Rule.

 

Create an Event Registry Entry:

  • Navigate to System Policy > Events > Registry.
  • Click New.
  • Name: incident.p1p2.email
  • Table: incident

 

Create the Business Rule:

  • Name: Send P1/P2 Email to Distribution List
  • Table: Incident [incident]
  • When: after (Update)
  • Conditions: Priority | is one of | 1 - Critical, 2 - High

(function executeRule(current, previous /*null when async*/) {

        var distributionList = 'p1p2_support@company.com'; // Replace with your actual Distribution List Email

    gs.eventQueue('incident.p1p2.email', current, distributionList, null);

})(current, previous);

 

Create the Notification:

  • Navigate to System Notification > Email > Notifications.
  • Click New.
  • Name: P1/P2 Incident Notification
  • Table: Incident [incident]
  • When to send: Event is incident.p1p2.email
  • Who will receive: Under "Event parm1 contains recipient", check the box.
  • What it will contain: Define subject and body.

refer post : Trigger P1 and P2 Notifications to Assignment Group for Incidents 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

ratnasekhar
Tera Contributor

Thank you @Tanushree Maiti please see my revised requirements .

 

Requirement 1
Ability to record a Distribution List against a CI, potentially through a custom field within ServiceNow, so Service Owners can maintain the relevant notification group.

Requirement 2
Automatic email notification to the recorded Distribution List (or potentially an Assignment Group in ServiceNow terminology) whenever:

  • a new Incident is created as P1/P2, or
  • an existing Incident is upgraded to P1/P2.

Hi @ratnasekhar 

 

For requirement 1,  do you want to send notification to specific DL when a specific CI Class's CI having a custom attribute and that is updated. Just trying to understand the trigger condition.

 

For requirement 2 - Probable solution is already given.

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

ratnasekhar
Tera Contributor

Yes to the DL of the CI captured in the incident 

Hi @ratnasekhar 

 

For requirement 1, You can do it in several ways.

 

Option1 : 

  1. Navigate to System Policy > Events > Registry.
  2. Click New.
  3. Event Name: incident.ci.changed (update it as you wish).
  4. Table: Incident [incident].
  5. Click Save.

 

Create a Business Rule

  1. Navigate to System Definition > Business Rules.
  2. Click New.
  3. Name: Fire Event on CI Change.
  4. Table: Incident [incident].
  5. Check Advanced.
  6. When: after.
  7. Check Insert and Update.
  8. Filter Conditions: Configuration item | Changes OR Configuration item | Is not empty.
  9. Under the Advanced tab, add the following script:

 

(function executeRule(current, previous /*null when async*/) {

    // Pass the CI display value in Parm1 and Incident Number in Parm2

    gs.eventQueue('incident.ci.changed', current, current.cmdb_ci.getDisplayValue(), current.number);

})(current, previous);

 

  1. Click Submit.

 

Create the Notification

  1. Navigate to System Notification > Email > Notifications.
  2. Click New.
  3. Name: Notify DL on Incident CI Change.
  4. Table: Incident [incident].
  5. When to send:
    • Send when: Event is fired.
    • Event name: incident.ci.changed.
  6. Who will receive:
    • Users/Groups: Add your specific group or users.
    • Email addresses: Add your Distribution List email address here (e.g., itsupport@example.com).
  7. What it will contain:
    • Subject: CI Updated for ${event.parm2}: ${current.short_description}
    • Message HTML:

<p>The Configuration Item for incident ${event.parm2} has been created or updated.</p>

<p><strong>New/Updated CI:</strong> ${event.parm1}</p>

<p><strong>Incident Description:</strong> ${short_description}</p>

<p><a href="${URI_REF}">Click here to view incident</a></p>

  1. Click Save.

 

Option2:  If users to subscribe/unsubscribe to CIs. OOB configuration is there.

Refer: KB0694157 How CI subscription notifications work 

 

Option3: You can do the same using flow designer FLOW

 

 

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti