The Event component is used to coordinate two asynchronous tasks. It is used when requests must be managed and results must be returned in the same transaction.
The following example includes two PBL scripts: the first PBL script requests and waits for an event; the second PBL script triggers the event. A Purchase Order Number event occurs between the PBLs.
// Request - Event
// Before processing a purchase order number in the PBL, you need to
// check if it exists in the database
event = Event (purchaseOrderNum)
// Send Request
waitFor event using timeout = '30s'
returning arguments = arguments
// Trigger - Event event = Event (purchaseOrderNum) // Query database and set custNuma and amount // custNum = ... // amount = ... // Respond to request trigger event using arguments = ["custNum" : custNum, "amount" : amount ]