--- title: Create a ServiceNow business rule for work notes slug: l68a0318 canonical_url: https://docs.coveo.com/en/l68a0318/ collection: coveo-for-servicenow source_format: adoc --- # Create a ServiceNow business rule for work notes You can create a ServiceNow [business rule](https://www.servicenow.com/docs/bundle/zurich-api-reference/page/script/business-rules/concept/c_BusinessRules.html) 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](https://docs.coveo.com/en/2113/). 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 can't 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, [disable Coveo for ServiceNow's built-in work notes feature](https://docs.coveo.com/en/l68a0318#disable-coveo-for-servicenows-built-in-work-notes) when using a ServiceNow business rule for work notes. To create a ServiceNow business rule for work notes: . In the Now Platform UI of your ServiceNow instance, navigate to **Administration** > **Business Rules**. . Click **New**. . Enter a descriptive **Name** for the business rule. . In the **Table** field, select **Coveo Attached Result**. . 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 on 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. ```javascript (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); ``` . Click **Submit**. . To avoid multiple work note entries, [disable Coveo for ServiceNow's built-in work notes feature](https://docs.coveo.com/en/l68a0318#disable-coveo-for-servicenows-built-in-work-notes). ## 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. . In the Now Platform UI of your ServiceNow instance, navigate to **Coveo** > **Properties**. . Disable the Coveo for ServiceNow work notes option. ![Coveo for ServiceNow work notes option](https://docs.coveo.com/en/assets/images/coveo-for-servicenow/coveo-for-servicenow-properties-work-notes.png)