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 when using the Coveo Insight Panel.

By default, the Coveo for ServiceNow integration automatically generates a work note when a user attaches or detaches a Coveo search result in a case or incident. However, 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.

Note

To avoid multiple work note entries when a user attaches or detaches a Coveo search result in a case or incident, we recommend that you disable Coveo for ServiceNow’s built-in work notes feature when using a ServiceNow business rule for work notes.

To create a ServiceNow business rule for work notes:

  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.

  7. To avoid multiple work note entries, disable Coveo for ServiceNow’s built-in work notes feature.

Disable Coveo for ServiceNow’s built-in work notes

By default, the Coveo for ServiceNow integration’s built-in work notes feature still generates a work note even if you’re using a ServiceNow business rule for work notes. This could lead to multiple work note entries if a user manually posts the work note that’s generated by the Coveo for ServiceNow integration. To avoid this, we recommend that you disable Coveo for ServiceNow’s built-in work notes feature when using a ServiceNow business rule for work notes.

  1. In the Now Platform UI of your ServiceNow instance, navigate to Coveo > Properties.

  2. Disable the Coveo for ServiceNow work notes option.

    Coveo for ServiceNow work notes option