From Bright Pattern Documentation
Jump to: navigation, search

onShowScreen

This callback is used for receiving the CRM screen data associated with an active interaction (i.e., when it changes). The parameters of this callback include the object that you set for the last active interaction with the setInteractionActiveScreen method.

Request

Syntax

on('ON_SHOW_SCREEN', handler: OnShowScreenHandler): void

type OnShowScreenHandler = (screen: InteractionScreen, interactionId?: string) => SyncAsyncResult

type InteractionScreen = Record<string, string | number | boolean | null | undefined>

Parameters

Parameter Parameter Values Data Type Optional/Required Description
screen object Required Any flat (i.e., not nested) object data added for the interaction via the setInteractionActiveScreen method
interactionId string Optional ID of the interaction to which the provided object belongs

Example Request

    adApi.on("ON_SHOW_SCREEN", (screen: InteractionScreen, interactionId?: string) => {

        const openedObjectId = screen.objectId;

	    openCRMObject({id: openedObjectId});

    });

Return Value

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

< Previous