Inserting logic to transform or validate event data
Draft comment:
This topic was viewed 14 times since its publication
You use the Script Adapter widget to insert logic that either transforms or validates event data that is sent by a widget. You use JavaScript code to implement the logic in the Script Adapter widget. The resulting value is contained in the payload of the event that is published by the Script Adapter widget.
This topic was viewed 14 times since its publication
Procedure
To insert logic into event communication on a page:
Example
The following example illustrates how you can use the
Script Adapter widget to change the type of case to be searched. In
this example, the search widget is to be used to locate only cases
of the type Homeowner Policy.
- Open the Cases page for the solution in Page Designer.
- Drag the Script Adapter widget onto the Cases page.
- From the Case Search widget menu, select Edit Wiring to
wire the Case Search widget to the Script Adapter widget..
- In the Script Adapter Incoming Events section, select Case Search from the Source widget list.
- Select Search cases from the Outgoing event list.
- Select Receive event payload from the Incoming event list.
- Click Add Wire and then click OK.
- From the Script Adapter widget menu, select Edit Settings and
then enter the following script in the JavaScript field:
payload.CaseType=\"Homeowner Policy\"; alert(\"Updated Case Type to - \" + payload.CaseType); return payload;This script updates the CaseType property in the payload from the Case Search event.
- Save the settings and then save and close the page.
- Deploy the solution.
In Case Client, a search will return only cases of the Homeowner Policy case type.
This topic is shared by BAW, CP4BA. Last updated on 2025-03-13 12:15