OIEP - Pre-processor - Business Action
By default, no pre-processor is included in an OIEP output template. Applying the Business Action Pre-processor means a business rule can be run against the data, prior to the export. For example, a node can be added to a current batch, or an event can be removed from the current batch before a message is created for an export.
Using this pre-processor requires:
- A business action - in this example, it will add referenced products to the products that are contained in the message.
- An event-based OIEP configured with the business action - in this example, it is configured to deliver messages that inform a downstream system about changes to a product.
Business Action Configuration
Create a business action that is valid for 'All Object Types.' For more information on creating business rules, refer to the Specifying a Business Action Operation topic.
In this example, the target products that are referenced via the Accessory Reference type are included as part of this event. The Execute JavaScript business action is used in conjunction with the Current Event Batch and STEP Manager binds so that any additions, removals, or modifications to the target products are published as part of the source product event. For information, refer to the Business Action: Execute JavaScript topic in the Business Rules documentation, the Event Handling Binds topic or the STEP Manager Bind topic of the Resource Materials online help documentation.
Note: More complex business actions can have an impact on the performance of the integration endpoint.
The JavaScript code used in this example is:
var events = batch.getEvents(); var accessoryReferenceType = manager.getReferenceTypeHome().getReferenceTypeByID("Accessory"); for (var i = 0; i < events.size(); i++) { var event = events.get(i); if (event.getSimpleEventType().getID() == "Modify") { var node = event.getNode(); if (node != null){ var accessoryReferences = node.getReferences(accesoryReferenceType); for (var j = 0; j < accessoryReference.size(); j++) { var accessoryTarget = accessoryReferences.get(j).getTarget(); batch.addAdditionalNode(accessoryTarget); } } } }
The business rule is configured in the System Setup tab under Global Business Rules as displayed below:
OIEP Configuration
Apply the business action as a pre-processor for any of the output templates on an OIEP.
- Create an event-based OIEP. For details, refer to the Creating an Event-Based Outbound Integration Endpoint topic.
- On the Configuration tab, open the Output Templates section and locate the output template that requires the business action.
- In the Pre-processor column, click the ellipsis button () to display the Select Pre-processor dialog.
- In Configure Pre-processor, select the Business Action Pre-processor option.
- In Business Action Pre-processor, select the business action created earlier. The output template is updated to show the pre-processor will run.