Show TOC

Updating Notification Processing Time and StatusLocate this document in the navigation structure

Use

You can update existing process notification instances at runtime by changing their processing time and status.

The processing time is represented by a deadline, which can be an exact date set in time, or duration related to some starting point (action or process start). For more information, see Creating Deadlines and Durations .

Prerequisites
Procedure
  1. Retrieve a notification instance defined for a process:

importcom.sap.caf.eu.gp.process.rt.notification.api.IGPNotificationInstance;
importjava.util.Enumeration;
 
// get all notification instances of a process
Enumerationnotifications = process.getNotificationInstanceEnumeration();
 
// retrieve a single notification instance
IGPNotificationInstancenotification = null;
while(notifications.hasMoreElements()) {
   notification = (IGPNotificationInstance) notifications.nextElement();
}

For more information, see Retrieving Process Notification Instances .

  1. Retrieve relevant information about the instance.

    Depending on the update operation you want to perform, you may need to know certain notification instance attributes in advance, for example, notification ID, process ID, whether it is a due date notification, and so on.

importcom.sap.caf.eu.gp.process.api.IGPDeadline;
 
//get relevant attribute information, for example:
StringprocessInstanceID = notification.getProcessInstanceID();
StringnotifID = notification.getNotificationID();
booleandueDate = notification.isDueDateNotification();
longcreateDate = notification.getCreationDate();
IGPDeadlinedeadline = notification.getDeadline();

...

  1. Change the status of the notification instance.
    Caution
    You are able to change the status of a notification instance only if it is not processed yet, that is, its status is set to
    NOTIFICATION_STATUS_WAITING
    . If the notification has been already executed or cancelled, this change is impossible.

    You can choose from the following notification statuses:

    • NOTIFICATION_STATUS_DEPRECATED
      - notification is deprecated, a more up-to-date version exists
    • NOTIFICATION_STATUS_EXECUTED
      - notification is executed
    • NOTIFICATION_STATUS_CANCELLED
      - the activity was completed before the time of notification processing
    • NOTIFICATION_STATUS_ERROR
      - an  error occurred during the processing of the notification

// update the status - cancel the notification
notifManager.updateNotificationStatus(
                        processInstanceID,
                        activityID,
                        notifID,
                        IGPNotificationInstance.NOTIFICATION_STATUS_CANCELLED
                       );
  1. Update the processing time of the notification instance.
    This operation automatically creates a new version of the notification. The status of the old version is set to deprecated (
    NOTIFICATION_STATUS_DEPRECATED
    ). Both versions are stored in the notification history.

importcom.sap.caf.eu.gp.process.rt.api.IGPNotificationManager;
 
// update the notification instance with a new deadline
notifManager.updateNotification(
                                processInstanceID,
                                activityID,
                                notifID,
                                deadline
                               );