Breadcrumb
- Sabre Red 360 Software Development Kit Help
- Web Red Apps
- New workflow extensions
- Handling 'cancel workflow' event
Handling 'cancel workflow' event
1. Add sabre-ngv-xp-registry
dependency to package.json
, ex.
"buildDependencies": {
"sabre-ngv-app": "*",
"sabre-ngv-core": "*",
"sabre-ngv-xp": "*",
"sabre-ngv-xp-registry": "*"
}
2. Import necessary type and constant from xp-registry
import {ExtPointAbortEventData, EXTENSION_POINT_ABORT_EVENT} from 'sabre-ngv-xp-registry/types/ExtensionPointPublicEvents';
3. Use EventBusService
to create function that executes when EXTENSION_POINT_ABORT_EVENT
is triggered.
const eb = getService(EventBusService);
eb.on(EXTENSION_POINT_ABORT_EVENT, (data: ExtPointAbortEventData) => {
})
4. Insert custom logic into the function body. The example below shows a banner with all the data send via ExtPointAbortEventData
object.
const eb = getService(EventBusService);
const areaService: IAreaService = getService(IAreaService);
eb.on(EXTENSION_POINT_ABORT_EVENT, (data: ExtPointAbortEventData) => {
areaService.showBanner('Info', 'Handling workflow abort from extension ' + data.extpId + ' with data type ' + data.dataType + ' actual data ' + JSON.stringify(data.data));
})
Check the com.sabre.redapp.example3.web.wf.abort.handler
sample for full implementation.