There are scenarios where task flows may need to raise the Contextual Events based on complex business conditions. Declarative event handling mechanism might not be sufficient in this case. Now the question is how to raise 'Contextual Events' programmatically from backing bean? Let me try summarizing the steps below. Please refer the Fusion Developer's Guide for detailed explanation on creation of Contextual Event.
1. Create the Producer (Payload) Method
2. Bind the Producer Method with task flow, which raises the event
3. Create the Consumer (Handler) Method
4. Map the Contextual Event i.e.: tell the system to use above defined Consumer for a specific event Producer
Once the above infrastructure is in place job is pretty simple. The below code snippet will help you to publish Contextual Event programmatically from the backing (managed) beans. Typically the below code may goes to the action handler methods defined in the backing bean.
DCBindingContainer bc = (DCBindingContainer)BindingContext.getCurrent).getCurrentBindingsEntry();
JUCtrlActionBinding actionBnd =
You can download the sample workspace from here.