Web Self Service Widget Events
While the widget runs, it triggers some events that the hosting page can listen to using the postmessage plugin. Each event also includes data relevant to the event. The ObjectinstanceId from the started event is stored so it can be used later in other APIs.
Use the following method to register an event:
Method | Return Value | Description | Example |
---|---|---|---|
registerEvent (eventName:string, callback ([event params])); | None | Registers an event with the callback that is invoked when the event is triggered. | webselfservice.registerEvent ('started', function(e) { intid.value=e.objectInstanceId; instanceid = e.objectInstanceId; }); |
The table below lists and describes the events for which you can invoke a callback function. These events are used in conjunction with the registerEvent API.
Event Name | Arguments | Description |
---|---|---|
started | Fired when a new Interaction is started (either manually by the user, or by calling the Start Interaction API. | |
ended | instanceId:string | Fired when an Interaction is finished. |
saved | instanceId:string | Fired when an Interaction is saved. |
loaded | Fired just after a new page is loaded into the content area. | |
onError | Fired whenever an error is about to be displayed. To suppress display of the error message box, return false from this handler. | |
redirectToLogin | redirectUrl:string | Fired when the value of the oauthMode property is redirect. For more information about this property, refer to Creating the Web Self Service Widget. . |
The following example shows handling of the redirectToLogin event when a secured Interaction fails to run:
pm.bind("redirectToLogin", function(url) { console.log(url); window.location = url; });