| Previous | Next |  | Contents | Index | Glossary

## Default_Rule

PL/SQL Syntax

`function Default_Rule`

        (p_subscription_guid in raw,

         p_event in out wf_event_t) return varchar2;

Description

Performs default subscription processing when no rule function is specified for an event subscription. The default processing includes:

- Sending the event message to a workflow process, if specified in the subscription definition

- Sending the event message to an agent, if specified in the subscription definition

If either of these operations raises an exception, Default_Rule() traps the exception, stores the error information in the event message, and returns the status code ERROR. Otherwise, Default_Rule() returns the status code SUCCESS.

> Note: If the event message is being sent to the Default Event Error workflow process, Default_Rule() generates a new correlation ID to use as the item key for the process in order to ensure that the item key is unique.

If you want to run a custom rule function on the event message before it is sent, you can define one subscription with a low phase number that uses the custom rule function, and then define another subscription with a higher phase number that uses the default rule function to send the event.

For example, follow these steps:

1. Define a subscription to the relevant event with your custom rule function and a phase of 10.

2. Define another subscription to the event with the rule function WF_EVENT.Default_Rule and a phase of 20, and specify the workflow or agent to which you want to send the event.

3. Raise the event to trigger the subscriptions. The subscription with the lower phase number will be executed first and will run your custom rule function on the event message. When the event is passed to the second subscription, the modified event message will be sent to the workflow or agent you specified.

You can also call Default_Rule() to add the default send processing within a custom rule function. If you enter a rule function other than Default_Rule() for a subscription, Oracle Workflow does not automatically send the event message to the workflow and agent specified in the subscription. Instead, if you want to send the message from the same subscription, you must explicitly include the send processing in your custom rule function, which you can optionally accomplish by calling Default_Rule(). See: Standard API for an Event Subscription Rule Function.

> Note: You may find it advantageous to define multiple subscriptions to an event with simple rule functions that you can reuse, rather than creating complex specialized rule functions that cannot be reused.

Arguments (input) | p_subscription_ guidThe globally unique identifier of the subscription.
p_event | The event message.

| Previous | Next |  | Contents | Index | Glossary