Step 3: Define optional events for the search widget
The search widget is completely functional for business users to view records when the two provided code blocks from Network have been added to your internal application. However, you can customize the behavior of the widget to meet your business needs. Web developers can define events which return a JSON response so you can use the data in your downstream systems.
Events are triggered when users perform an action in the search widget.
Download record events
Define an event so users can download records from the search widget to your internal application. By default, if the user clicks the Select button on the search result, the record is downloaded to your Network instance. Downloading the record to the internal application enables users to complete transactions on the record; for example, adding the HCP to an expense report.
Web developers can define a select event to trigger when users click the button beside the search result. When the event triggers, a JSON returns the primary information for the selected record (HCP or HCO); for example, name, Network entity ID (VID), addresses, licenses, parent HCOs, alternate keys, and custom keys. Web developers can customize the JSON so that the record can be added to your downstream system.
More information, along with code samples, is available on the Veeva Network developer site at https://developer.veevanetwork.com/widgets/.
Add request events
If your search widget supports creating add requests, two events can be defined so the task information is returned so it can be stored in your downstream system. The events are triggered when users click the Add Account button to submit a new record.
By default, when users click the button, add requests are routed to data stewards to validate, but users are able to immediately action the record in your internal application. After the add request is processed, the record is added to your Network instance.
The dcr-presubmit event provides the data from the add request. This includes the creator (user that submitted the add request), the comments from the Notes section, and all of the new field values that the user provided for the record and the associated sub-objects (addresses, licenses, parent HCO affiliations). When users click Add Account, a JSON response can return this data. Developers can customize the JSON so the data can be stored in your downstream system.
The dcr-submitted event provides the task ID in a JSON response for the submitted add request.
select event triggers, a JSON returns the entire record information for the selected record (HCP or HCO); for example, name, Network entity ID (VID), addresses, licenses, parent HCOs, alternate keys, and custom keys. This is the same as the select event for downloading a record. Web developers can retrieve the task ID from the JSON so it can be stored in your downstream system.
Using reference aliases
Network reference codes are returned in the JSON by default. Reference aliases can be used so the JSON returns data that your downstream system will understand. For example, the Network reference code for New York state is US-NY. If your downstream system identifies New York state as NY, you can create that reference alias in Network so the JSON returns NY.
Reference aliases are specific to source systems, so administrators can create the mapping for the system that you specify in the widget configuration.
For more information about mapping Network codes to values for your downstream, see Reference aliases.
|< Step 2: Embed the search widget||Developers: Configure your web application >|