From Bright Pattern Documentation

Revision as of 20:10, 2 April 2026 by Laura.donovan (talk | contribs) (Updated via BpClonePage extension. Source page: draft:AgentDesktop-client-side-javascript-api-specification/onOpenRecord)

< Previous | Next >
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

onOpenRecord

Communicator Widget sends this event when it needs to display a certain CRM record. This can happen on multiple occasions:

  • When a CRM screen pop block is configured for interaction in scenario.
  • User clicks on a CRM record link from Recent items in the widget.
  • User clicks on a record from the Quick Record Access popup during interaction.
  • User clicks on a record from the Associated Records tab during interaction.

Request

Syntax

on('ON_OPEN_RECORD', handler: OnOpenRecordHandler): void


type OnOpenRecordHandler = (record: InteractionAssociatedObjectData, interactionId?: string, options?: OpenRecordOptions) => SyncAsyncResult

type InteractionAssociatedObjectData = {

   id: string

   type: string

   displayName: string

   displayType: string

   customFields: Record<string, string>

}

type OpenRecordOptions = {

   inNewTab: boolean

   source: "user" | "scenario"

}

Parameters

Parameter Parameter Values Data Type Optional/Required Description
record object Required Record data which should be opened
id string Required ID of the record
type string Required Record type (contact, case, task, etc.)
displayName string Required Display name of the record
displayType string Required Display type of the record
customFields object Required Any additional information about the record you want to preserve
interactionId string Optional ID of the interaction which is associated with the action
options object Optional Action configuration
inNewTab boolean Required Specifies the intention to open the record in new tab
source string Required This parameter allows to determine whether the event was produced by direct user action (on click) or automatically (from a scenario)

Example Request

    adApi.on("ON_OPEN_RECORD", function (record, interactionId, options) {

        if (options.inNewTab) {

            openCrmRecordWindow(record.id);

        } else {

            switchScreenToCrmRecord(record.id);

        }

    });

Return Value

The handler may return a value or Promise (SyncAsyncResult). Return value is typically not used.

< Previous | Next >