From Bright Pattern Documentation
onRequestRecordOnScreen
Implement a handler for this event if you want to use the "Direct Chat" feature in Agent Desktop. It should return data about the currently opened record on the CRM screen.
Request
Syntax
| on('ON_REQUEST_RECORD_ON_SCREEN', handler: OnRequestRecordOnScreenHandler): void
type OnRequestRecordOnScreenHandler = () => SyncAsyncResult<InteractionAssociatedObjectData | null> type InteractionAssociatedObjectData = { id: string type: string displayName: string displayType: string customFields: Record<string, string> } |
Parameters
None
Example Request
adApi.on("ON_REQUEST_RECORD_ON_SCREEN", () => {
return crmApi.getActiveRecord().then(record => {
return {
id: record.get("sys_id"),
type: record.get("sys_type"),
displayName: record.get("description"),
displayType: record.get("sys_type"),
customFields: {},
}
)
})
Return Value
| Object | Object Values | Data Type | Optional? (Y/N) | Value Description |
| InteractionAssociatedObjectData | object or null | Info about CRM object on screen. null if no records are opened. | ||
| id | string | Record's unique ID | ||
| type | string | Type of the record (contact, case, task, etc.) | ||
| displayName | string | Display name of the record | ||
| displayType | string | Display type the record | ||
| customFields | object | Any additional information about the record |