How do I define notification triggers?

Here's how you define a Groovy script for a notification trigger:

  1. Sign in to the application as a setup or administrator user.

  2. Click Navigator > Configuration > Sandboxes.

  3. Create a sandbox or select an existing one, and click Enter Sandbox to activate the sandbox. Your sandbox is activated, and you can see its name on the sandbox bar over the global header.

  4. In the Navigator, click Application Composer. The Application Composer page is displayed.

  5. Select Objects > Standard Objects > Service Request > Server Scripts. The Server Scripts Service Request section is displayed.

  6. Click the Triggers tab.

  7. From the Action menu, click Add. The Create Object Trigger section is displayed.

  8. Create a Groovy trigger:

    1. Specify the Name, Error Message, and Trigger Definition details.

      • Oracle recommends you to use the trigger type After Changes Posted to Database. This trigger type enables you to stop potential issues if the Groovy script is accidentally written to run indefinitely. If the trigger type is set to Before Update to Database, with a bad script, there may be some issues.

      • If you're creating a new object, and you want to trigger a notification when the object is created, Oracle recommends you to use the trigger type Before Insert to Database. However, some of the Before trigger types don't have all attributes exposed yet, resulting in some fields being blank. To debug your triggers if you're not getting the expected results, follow the steps in the section "Debug Groovy Triggers".

      • The isAttributeChanged() function works only for the Before trigger types. The workaround for the After trigger types involves retrieving the old value before the database is updated, then retrieving the new value after the update, and then comparing the two values to see whether the attribute is changed. However, this workaround works only for high-level attributes such as CriticalFlag and Status. This workaround may not work for the ViewRow attribute, for example, when you're retrieving the team from an SR.

      When you create a Groovy script, you need the API names of the fields you're trying to access. To create your triggers based on parent/child fields, do the following:

      1. In the Trigger Definition section, click Show/Hide Expression Palette.

      2. Click the Fields tab.

      3. Select an Object.

      4. Click the Maximize Edit Script arrow. The fields for the selected object are displayed.

      5. Select the API you want, and click Insert.

      6. To close the expression palette, click the Restore Edit Script arrow, and then click Show/Hide Expression Palette.

    2. Click Save and Close.

  9. Navigate to the Notification Preferences page to configure your preferences for the notifications.

    For more information about configuring notification preferences, see the "Set Notification Preferences" topic.

    Note: You can reuse a Groovy notification trigger if no other notification uses it.