18Configure Notifications

This chapter contains the following:

Set Notification Triggers and Preferences

A notification is an alert for users such as service agents and managers, to notify them about an event on the service request, and enable them to take the necessary actions.

Enabling notifications is a global setup and feature opt-in step. Here's how you enable the notifications feature for service requests:

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

  2. Navigate to Setup and Maintenance.

  3. Select the Service offering.

  4. In the Functional Areas section, select Productivity Tools > Change Feature Selection.

    The Edit Features: Productivity Tools page is displayed.

  5. Select the Enable check box for Notifications.

    When the Notifications feature is enabled, bell notifications are automatically enabled for service requests.

  6. To enable push notifications for mobile devices, select the Enable check box for Mobile Notifications.

How You Set Up Groovy Notification Triggers

As an administrator, here's how you configure notifications after you have enabled the notifications feature:

  1. Define notification triggers as Groovy scripts in Application Composer, containing the conditions that must be met for each notification. Notifications are triggered when the defined conditions are met. For example, a trigger can be defined to send a notification when a high severity SR has been assigned to an agent.

    For more information about defining notification triggers, see the "Define Notification Triggers" section.

  2. Configure the notification preferences using the Notification Preferences page. For example, to specify the notification message using SmartText, and the notification recipient.

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

Note:
  • You can temporarily disable all notifications using the profile option SVC_DISABLE_BO_NOTIFICATIONS. Oracle recommends to use this option when you're doing a bulk import of data, so that you don't get multiple notifications.

  • You can temporarily enable or disable specific notifications from the Notification Preferences page.

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 Set as Active to activate the sandbox. The sandbox is designated as the active sandbox.

  4. Close the Manage Sandboxes window.

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

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

  7. Click the Triggers tab.

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

  9. 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.

  10. 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.

The Notification Preferences page enables administrators to configure the notification rules. Users who have the ORA_SVC_SR_ADMINISTRATOR or ORA_SVC_SR_POWER_USER duty roles can access this page.

Here's how you configure the notification rules:

  1. Sign in to the application as an administrator.

  2. In the Navigator, click Tools > Notification Preferences.

    The Notification Preferences page is displayed.

  3. From the Object drop-down list, select Service Request or Work Order.

    1. Click Add. A blank row is added in the table.

    2. To enable the notification trigger, select Yes from Enabled drop-down list.

    3. Select a Groovy notification trigger from the Triggering Event drop-down list.

    4. Enter the Notification Name and Description.

    5. In the Recipients column, click Edit.

      The Configuration for Trigger Name dialog box is displayed.

    6. Select the notification delivery options for the respective recipients.

      For an enabled triggering event, notifications are sent to the specified recipients only if you select at least one delivery option. If any delivery method is selected for a specific recipient, that recipient will also receive bell notifications. Additionally, if you do not select the Bell Notifications option, then no notifications will be sent to the specified recipients.

      The following tables describe the recipients and delivery options for the respective objects:

      Recipients for Service Request Object Delivery Options for Service Request Object
      • Assigned To: Resource to whom the service request is assigned.

      • Manager of Assigned To: Manager of the resource to whom the service request is assigned.

        If a service level agreement is about to expire, and immediate attention is required, the manager of the resource to whom the service request is assigned, can be informed.

      • Resource Team: Additional resources that have been added to a service request on the Team subtab.

        If you have a team of resources collaborating on a service request, and a trigger such as the service request escalating to Critical status happens, the entire team can be informed.

      • Queue Owner: Owner of the queue.

        If your organization uses manual assignment, the queue owner can be notified when a new service request is associated with a queue owned by the queue owner. For information about the setup steps required to send a notification to a queue owner, see the "Trigger a Notification to the Queue Owner" section.

      • Bell Notifications: Sends a bell notification to the web application.

      • Mobile Notifications: Sends a mobile push notification to the Oracle CX Cloud Mobile application.

      • Browser Notifications: Sends a real-time notification to the desktop of the selected users that are signed in the Omnichannel toolbar, when a predefined trigger is executed.

      Recipients for Work Order Object Delivery Options for Work Order Object
      • Assigned To: Resource to whom the work order is assigned.

      • Created By: The user who created the Work Order

      • Field Service Resource ID: The resource ID being used to complete the work order

      • Last Updated By: The user who last updated the work order.

      • Manager of Assigned To ID: Manager of the resource to whom the work order is assigned.

        If a service level agreement is about to expire, and immediate attention is required, the manager of the resource to whom the work order is assigned, can be informed.

      • Requested By: The user who reported this work order.

      • Bell Notifications: Sends a bell notification to the web application.

      • Browser Notifications: Sends a real-time notification to the desktop of the selected users that are signed in the Omnichannel toolbar, when a predefined trigger is executed.

    7. Click the New SmartText link and enter the Notification Text for the selected object.

      For more information about using SmartText, see "Using SmartText" in Related Topics.

  4. (Optional) To delete a notification preference, select the row and click Delete. The associated notification text is also deleted.

    Note: If you delete a notification that uses a Groovy notification trigger, you can create a new notification using the same trigger, if no other notification uses it.
  5. (Optional) To modify an existing notification text, click the Update SmartText icon for the selected row.

  6. Click Save.

Here's how you trigger a notification to the queue owner:

  1. Define a dynamic choice list field on the Queue object for selecting a resource member:

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

    2. Within a sandbox, navigate to Application Composer.

    3. Click Standard Objects > Queue > Fields.

      The Fields page is displayed, with the Custom tab selected.

    4. Click Create a custom field.

      The Select Field Type dialog box is displayed.

    5. Select Choice List (Dynamic) and click OK.

      The Create Dynamic Choice List : Basic Information page is displayed.

    6. Enter CustomQueueOwner in the Display Label field and click Next.

      The Create Dynamic Choice List : List of Values page is displayed.

    7. From the Related Object drop-down list, select Resource.

    8. From the List Selection Display Value drop-down list, select Resource Name.

  2. Modify the Queue Create layout for setting the queue owner:

    1. Click Standard Objects > Queue > Pages.

      The Queue: Pages page is displayed.

    2. In the Creation Page Layouts section, click Edit to modify the Queue Create layout.

    3. Move CustomQueueOwner to the Selected Fields list.

    4. Click Save and Close.

  3. Define a trigger on the Queue object for associating the OwnerResourceID with PartyID:

    1. Click Standard Objects > Queue > Server Scripts.

      The Server Scripts Queue page is displayed.

    2. Create an object trigger and enter the following script in the Trigger Definition section:

      source.setAttribute("OwnerResourceId",CustomQueueOwner_Obj_c?.PartyId);

    3. Click Save and Close.

  4. Define the notification preference for the Service Request object:

    1. Click Standard Objects > Service Request > Server Scripts.

      The Server Scripts Service Request page is displayed.

    2. Create an object trigger for service request escalated. For a sample Groovy script, see the "Sample Groovy Scripts for Notifications" section.

    3. In the Navigator, click Tools > Notification Preferences.

      The Notification Preferences page is displayed.

    4. Create a notification preference using the service request escalated trigger. For the Recipients option, select only Queue Owner.

  5. Create a queue for associating the queue owner with a resource:

    1. On the Home page, click Service > Queues.

      The Queues page is displayed.

    2. Create a queue and specify a Name for the queue.

    3. From the CustomQueueOwner drop-down list, select a resource member.

    4. Click Save and Close.

  6. On the Create or Edit Service Request page, from the Queue drop-down list, select the queue name you specified in the previous step.

  7. Trigger a notification to the specified queue owner by enabling or disabling the Critical status.

Debug Groovy Triggers

Within your Groovy scripts, all your println statements go to the runtime messages. Here's how you view the runtime log and debug your Groovy script:

  1. Within a sandbox, navigate to Application Composer.

  2. Select Common Setup > Run Time Messages. The Run Time Messages section is displayed.

  3. Select the Enable Application Script Logging check box.

  4. Trigger your notifications.

    If the Groovy script has appropriate println statements, you receive runtime messages when you navigate back to the Run Time Messages section in Application Composer.

Sample Groovy Scripts for Notifications

Service Request Assigned

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when the service request (SR) is assigned:

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Update in Database
*  OBJECT: Service Request
*  Use Case: Send a notification when an existing SR is reassigned.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/

 if (isAttributeChanged('AssigneeResourceId')) {
    try {
        def recipientPartyId = AssigneeResourceId
        def messageText = 'An SR notification (default message).'
 
        if (recipientPartyId) {
         //Call to send notification
            adf.util.sendNotification(adf, messageText, recipientPartyId)
 
       //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
     //println("Notification sent to " + recipientPartyId + " because the SR was assigned to them.")
    } else {
            println("No Assignee associated with this SR")
        }
    } catch (e) {
     //Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
     println("Failure to trigger notification from Groovy Script " + e.getMessage());
// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
   }
}

Service Request Resolved

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when the SR is resolved:

Note: You must set the SVC_ENABLE_RESOLVE_SR profile option for the SR resolved Groovy script to work correctly.
/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Update in Database
*  OBJECT: Service Request
*  Use Case: Send a notification to the primary contact when an SR has been resolved.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/

if (isAttributeChanged('StatusCd')&& StatusCd == 'ORA_SVC_RESOLVED') {
    try {
        def recipientPartyId = PrimaryContactPartyId
        def messageText = 'An SR notification (default message).'
				
		if (recipientPartyId) {
				//Call to send notification
				adf.util.sendNotification(adf, messageText, recipientPartyId)

				//Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
				//println("Notification sent to " + recipientPartyId + " because the SR was resolved.")
				} else {
            println("No Assignee associated with this SR")
         }
       } catch (e) {
			//Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
			println("Failure to trigger notification from Groovy Script " + e.getMessage());

// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
   }
}

Service Request Escalated

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when the SR is escalated:

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Update in Database
*  OBJECT: Service Request
*  Use Case: Send a notification when an SR is escalated.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/

if (isAttributeChanged('CriticalFlag') && CriticalFlag=='Y') { 
    try {
        def recipientPartyId = AssigneeResourceId
        def messageText = 'An SR notification (default message).'
 
        if (recipientPartyId) {
       //Call to send notification
        adf.util.sendNotification(adf, messageText, recipientPartyId)

      //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
     //println("Notification sent to " + recipientPartyId + " because the SR was escalated.")
     } else {
     println("No Assignee associated with this SR")
     }  
    } catch (e) {
      //Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
      println("Failure to trigger notification from Groovy Script " + e.getMessage());
 
// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
   }
}

Customer Replies to a Message

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when a customer replies to a message.

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Insert to Database
*  OBJECT: Messages (child of Service Request)
*  Use Case: Send a notification to the assignee when a customer entry is created.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/
if (MessageTypeCd == 'ORA_SVC_CUSTOMER_ENTRY') {
    try {
 
        // Note: The notation ServiceRequest?.SrNumber is used because ServiceRequest is the parent
        // object of Messages. To access the other possible field names, expand the trigger box, click on fx,
        // click on Fields, and select the drop-down list from Message. Click on Service Request to see the
        // available fields. You must click Insert to correctly insert the appropriate field into your script.
 
        def messageText = "A customer entry was received for " + ServiceRequest?.SrNumber
        def recipientPartyId = ServiceRequest?.AssigneeResourceId
        if (recipientPartyId) {
            // Call to send notification
            adf.util.sendNotification(adf, messageText, recipientPartyId)
          //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
         //println("Notification sent to " +  recipientPartyId + " because a customer entry was received.")
         } else {
         println("No Assignee associated with this SR")
         }
     } catch (e) {

     // Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
     println("Failure to trigger notification from Groovy Script " + e.getMessage());

// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
   }
}

Expired Milestone

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when a milestone expires:

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Update in Database
*  OBJECT: Milestone (child of Service Request)
*  Use Case: Send a notification to the assignee when an SR milestone is expiring.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/

if (isAttributeChanged('WarnedFlag') && WarnedFlag=='Y') { 
    try {
        def recipientPartyId = SrAssigneePartyId
        def messageText = 'An SR milestone notification (default message).'
 
        if (recipientPartyId) {
        //Call to send notification
        adf.util.sendNotification(adf, messageText, recipientPartyId)
       //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
      //println("Notification sent to " + recipientPartyId + " because the SR was escalated.")
      } else {
            println("No Assignee associated with this SR")
      }  
    } catch (e) {
     //Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
     println("Failure to trigger notification from Groovy Script " + e.getMessage());

// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
  }
}

Work Order Assigned

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when a work order is created:

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Insert to Database
*  OBJECT: Work Order
*  Use Case: Send a notification when a work order is created.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
*/

try {
        def messageText = WoId.toString() + ':' + WoNumber + ' - This Work Order has been assigned to you'
        def recipientPartyId = AssigneeResourceId
        def recipientName = AssigneePersonName
        if (recipientPartyId) {
            adf.util.sendNotification(adf, messageText, recipientPartyId)
        //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
       //println("Notification sent to " + recipientName + " because Work Order assigned to them")
       } else {
            println("No Assignee associated with this Work Order")
       }
    } catch (e) {
       //Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
       println("Failure to trigger notification from Groovy Script " + e.getMessage());

// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger.
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
  }
)

Work Order Complete

Here's a sample code to trigger a notification to be sent to the recipient specified in the Notification Preferences page when a work order status is updated to complete:

/* DISCLAIMER: This trigger is provided only as a reference.
*  TRIGGER TYPE: Before Update to Database
*  OBJECT: Work Order
*  Use Case: Send a notification when a work order is completed.
*  Note: You can override the Notification Text and Recipients using the Notification Preferences page.
* When WO_STATUS_CD is exposed in Application Composer, this script can be changed. Change everywhere that says 'WoStatusCdMeaning' to 'WoStatusCd'
* and change the comparison in the if statement to 'ORA_SVC_WO_COMPLETE' instead of 'Complete'.
*/

if (isAttributeChanged('WoStatusCdMeaning') && WoStatusCdMeaning == 'Complete') {
    try {
        def messageText = WoId.toString() + ':' + WoNumber + ' - This Work Order has been Completed'
        def recipientPartyId = AssigneeResourceId
        def recipientName = AssigneePersonName
        if (recipientPartyId) {
            adf.util.sendNotification(adf, messageText, recipientPartyId)
            //Log a confirmation that the notification has been sent. Logs can be viewed in 'Runtime Messages'.
           //println("Notification sent to " + recipientName + " because status of WO is Complete")
        } else {
            println("No Assignee associated with this Work Order")
        }
    } catch (e) {
        //Log the failure in groovy logging. Logs can be viewed in 'Runtime Messages'.
        println("Failure to trigger notification from Groovy Script " + e.getMessage());

// Throwing validation exception will show the message on the UI. This is not recommended for published sandboxes.
// The following code is one of many to illustrate identifying an error in trigger from the UI.
// Replace <triggerName> with the trigger name you specified when creating this trigger
// throw new oracle.jbo.ValidationException('Failure to trigger <triggerName> Notification from Groovy Script: ' + e.getMessage())
   }
}

Set Push Notifications

Configure Push Notifications

With the push notification framework users, such as service agents and managers, can get push notifications about service request events delivered to their mobile devices. Once an agent is signed in to the mobile application, they can view a list of their notifications by clicking the Notifications icon on the global header. Notifications can be dismissed after viewing, or dismissed in bulk.

You define notifications in Application Composer with your unique conditional logic. This lets you decide when to raise each notification. For example, you can define alerts for upcoming SLA milestones, reassignments, or escalations. The administrator can also decide whether to enable mobile push notifications for certain alerts, or to deliver the alerts only to the Bell notifications on the desktop application. Note that bell notifications are always delivered, even if mobile notifications are disabled. Clicking a notification and navigating to the record details marks the notification as read, and it's cleared from the notification list.

You define notification triggers as a groovy expression in Application Composer using conditions that must be met for each notification. For example, a trigger can be defined to send a notification when a high-severity service request is assigned to a user. When the Service Notifications feature is enabled, Bell notifications are automatically enabled.

Push notifications are supported in iOS and Android devices.

Here's what you do to enable push notifications:

  1. Log in as an administrator, click Setup and Maintenance, and then from the Setup menu, select Service.

  2. In the Functional Areas section, select Productivity Tools, and then select Change Feature Selection.

  3. Select Service Notifications, then click the Enable check box to enable Service Notifications and Mobile Notifications.