Create a ServiceNow Business Rule for Work Notes

You can create a ServiceNow business rule that automatically adds a custom work note when a user attaches or detaches a Coveo search result in a case or incident, such as in the Insight Panel or Agent Workspace.

Though the Coveo for ServiceNow integration does support adding work notes, it requires a user to click Post after attaching or detaching the item, and the automatically generated work note content is hardcoded and cannot be modified. Therefore, we recommend that you leverage ServiceNow’s business rule capabilities to automate the addition of custom work notes when using Coveo for ServiceNow.

When a user attaches or detaches a Coveo search result in a case or incident, the Coveo for ServiceNow integration automatically generates a work note, which appears in either a Note or Comment field, even if you’re using a business rule to add work notes. This could lead to duplicate work note entries if a user manually posts the work note that’s generated by the Coveo for ServiceNow integration.

To set up a business rule to use with Coveo for ServiceNow:

  1. In the Now Platform UI of your ServiceNow instance, navigate to Administration > Business Rules.

  2. Click New.

  3. Enter a descriptive Name for the business rule.

  4. In the Table field, select Coveo Attached Result.

  5. To configure the business rule, such as when it runs and the message that appears for the note, set the fields or enter a custom script in the Advanced tab.

    EXAMPLE

    The following script adds a custom work note when a user attaches a Coveo search result, and a separate custom work note when a user detaches a result.

    (function executeRule(current, previous /*null when async*/) {
        var taskRecord = new GlideRecord("task");
        if (taskRecord.get(current.case_id)) {
            if (current.operation() == "insert") {
                taskRecord.work_notes = "Attached " + current.title;
            } else {
                taskRecord.work_notes = "Detached " + current.title;
            }
            taskRecord.update();
        }
    }) (current,previous);
  6. Click Submit.

Recommended Articles