| Previous | Next |  | Contents | Index | Glossary

## Post-Notification Functions

You can associate a post-notification function with a notification activity. The Workflow Engine executes the post-notification function in response to an update of the notification's state after the notification is delivered. For example, you can specify a post-notification function that executes when the notification recipient forwards or transfers the notification. The post-notification function could perform backend logic to either validate the legitimacy of the forward/transfer or execute some other supporting logic.

The post-notification function should be a PL/SQL procedure written to the same API standards required for function activities. See: Standard API for PL/SQL Procedures Called by Function Activities.

When you specify a post-notification function, the Workflow Engine first sets the context information to use with the function via the following two global engine variables:

- WF_ENGINE.context_nid = notification_ID.

- WF_ENGINE.context_text = new recipient_role, if the post-notification function gets called in FORWARD or TRANSFER mode. This variable is the new role to which the notification gets forwarded/transferred;

or

WF_ENGINE.context_text = responder, if the post-notification function gets called in RESPOND mode.

> Note: The value of responder varies depending on the notification interface the recipient uses to respond. If the recipient responds using the Notification web page, responder is set to the role name of the responder. If the recipient responds via e-mail, responder is set to "email:responder_email_address".

You may reference these global engine variables in your PL/SQL function.

Then when the notification's state changes, a notification callback function executes the post-notification function in the mode that matches the notification's state: RESPOND, FORWARD, or TRANSFER.

When the Notification System completes execution of the post-notification function in RESPOND mode, the Workflow Engine automatically runs the post-notification function again in RUN mode. In this mode, the post-notification function can perform additional processing such as vote tallying.

If a notification activity times out, the Workflow Engine runs the post-notification function for the activity in TIMEOUT mode. For a Voting activity, the TIMEOUT mode logic should identify how to tally the votes received up until the timeout.

When the post-notification function completes, the Workflow Engine erases the two global engine variables.

As a final step, if the post-notification function is run in TRANSFER mode and Expand Roles is not checked for the notification activity, the Workflow Engine sets the assigned user for the notification to the new role name specified.

> Attention: If the post-notification function returns ERROR:<errcode> as a result or raises an exception, the Workflow Engine aborts the respond, forward, or transfer operation. For example, if the post-notification function is executed in FORWARD mode and it raises an exception because the role being forwarded to is invalid, an error is displayed to the user and the Forward operation does not get executed. The notification recipient is then prompted again to take some type of action.

### See Also

Notification Model

| Previous | Next |  | Contents | Index | Glossary