318 views

Description

If you create an incident from Connect Support, but continue with chat activity with the end user, an email message is generated for each chat update. These email messages are not necessary.

Steps to Reproduce

  1. Initiate a Connect Support chat queue session with a user.
  2. Create an incident from the Connect chat session.
  3. Continue chatting back and forth within the Connect session.
  4. Review the email log.
    Note that each message creates an incident.commented email. Connect chat should allow for decoupling of those messages. This could, for example, be handled by submitting a different event instead of incident.commented to allow email messages to be excluded for continued chat activity.

Workaround

Check the transaction that is triggering the update to the comments of the incident. If it is from a Connect API, then that specific notification should not be sent. This can be done by making simple modifications to the business rule creating the events.

In a base system instance, the business rule responsible for the behavior is named "incident events." The following steps explain how to change the "incident events" business rule to correct the issue.

  1. Navigate to the "incident events" business rule using the following URL:

    nav_to.do?uri=sys_script.do?sys_id=d56b5d71c0a80164019d0e0be2cf784f

  2. Add the following new "getPath" function at the bottom of the script after all other lines of code:

    function getPath() {
    var transaction = GlideTransaction.get();
    if (!transaction)
    return;

    var req = transaction.getRequest();
    if (!req)
    return;

    var path = req.getRequestURI() || "";
    return path;
    }

  3. Locate the lines of code that are creating the "incident.commented" event. In a base system instance, this code appears at the very top of the business rule as follows:

    if (current.operation() != 'insert' && current.comments.changes()) {
      gs.eventQueue("incident.commented", current, gs.getUserID(), gs.getUserName());
    }

  4. Edit the code above so it reads as follows:

    // Changes below are to work around PRB681459. All this is doing is verifying the
    // transaction which triggered the business rule was a connect transaction using a regex.

    if (current.operation() != 'insert' && current.comments.changes()) {
    var path = getPath() || "";
    if (!path.match(/\/api\/now\/connect/))
    gs.eventQueue("incident.commented", current, gs.getUserID(), gs.getUserName());
    }

  5. Save the business rule. 

    NOTE 1: if the connect API call changes in a future release then the business rule needs to be updated to check for that call instead.

    NOTE 2: The notifications for incident commented may use a condition (comments.changes) instead of the incident.commented event, and if this is the case, you need to change them to use the event instead. 

    1) Navigate to System Notification > Email >Notifications
     
    2) Search for the Name contains "incident" and "comment"
    3) Switch to the advanced view if needed
    4) In the when to send section, change "send when" to be Event is fired 
    5) Since the event name should already be set in the OOB notifications you just need to save the Notification. 

     


Related Problem: PRB681459

Seen In

Geneva Patch 4
Geneva Patch 6 Hot Fix 2
Geneva Patch 7
Geneva Patch 7 Hot Fix 2
Helsinki Patch 5

Intended Fix Version

Madrid

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-06-18 00:35:58
Published:2018-06-18