From Bright Pattern Documentation
Jump to: navigation, search
• 5.19


setInteractionActiveScreen

Send to the Agent Desktop application arbitrary data that can be used to restore the current CRM screen state. The data will be received via the API callback onActivateInteractionScreen after the active interaction has been switched to another interaction being handled.

Request

Syntax

setInteractionActiveScreen(screenData: InteractionScreen, interactionId?: string): Promise<OperationResult<null>>

Where:

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

Parameters

Parameter Parameter Values Data Type Optional/Required Description
screenData Required An arbitrary set of data, enough to restore CRM screen state
interactionId String Optional The ID of interaction, for which you want to save screen data. If not provided, a variable will be set in for the currently active interaction.

Example Request

    setInteractionActiveScreenButton.onclick = () => {

        let activeScreenData: any | null = null

        try {

            activeScreenData = JSON.parse(activeScreenTextarea.value)

        } catch (e) {

            alert('You have syntax error in the active screen data structure. Cannot parse JSON.')

        }

        if (!activeScreenData) {

            return

        }

        const itemId = activeAssociatedInteractionIdInput.value

        adApi.setInteractionActiveScreen(activeScreenData, itemId)

    }

Return Value

null

< Previous | Next >