How to Create a Chat Scenario That Pops Case or Contact InformationThe Agent Desktop application contains robust case and contact management features, allowing your agents to save, search for, and preview just about any information related to interactions; this information lives in internal databases. Through scenarios, it is possible to make your extensive case and contact information instantly available to agents when interactions begin, all without your agents having to search for it. Not only will this help your agents save precious time, it keeps your returning customers happy, too.This scenario example shows how, with only a few blocks, it is possible to pop an existing contact's case information to an agent. [[File:Scenario-Pop-Case-in-AD-53.PNG|800px|thumb|center|How a saved contact's cases look when popped to an agent]][[File:App_Screen_Pop_Customer_Cases.zip]]For instructions on how to import this file into your contact center, see the ''Contact Center Administrator Guide'', section [[Contact-center-administrator-guide/ScenariosOverview#How_to_Export_and_Import_Scenarios|Scenarios Overview > How to Export and Import Scenarios]].For general information about scenarios, refer to section [[Scenario-builder-reference-guide/ScenarioBuilderOverview|Scenario Builder Overview]].The following chat scenario shows how a saved contact's email address is used to pop related case information to an agent; this is accomplished by using the [[Scenario-builder-reference-guide/BrightPatternSearchObject|Bright Pattern Search Object]] block, the [[Scenario-builder-reference-guide/If|If]] block, and the [[Scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block.'''Designer's note''': Most of the configuration steps in this example can be applied in a voice scenario, albeit with the appropriate voice-related blocks and variables; in both chat and voice scenarios, the [[#Access_URLs|URLs]] required in the [[Scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block are the same. Finally, note that this is an example scenario only and not intended for production use. All [[Scenario-builder-reference-guide/ScenarioBuilderOverview#Conditional_Exits|conditional exits]] should be defined with actions for production use. The diagram shown illustrates what the complete scenario looks like when designed in the Scenario Builder application.[[File:Scenario-Pop-Case-Overview-53.PNG|800px|thumb|center]]First, we use the [[Scenario-builder-reference-guide/SetVariable|Set Variable]] block to rename the variable ''$(item.externalChatData.email)'' as ''chat.email''. Note that renaming $(item.externalChatData.email) is an optional step done to make the variable name easier to type in subsequent blocks.As a reminder, the variable $(item.externalChatData) pulls information from your configured chat widget; $(item.externalChatData.email) specifically references the email field we have configured in it.[[File:Scenario-Pop-Case-1-53.PNG|800px|thumb|center|Optional Set Variable block]]Next, we use the [[Scenario-builder-reference-guide/BrightPatternSearchObject|Bright Pattern Search Object]] block to search our internal database for an existing contact where the email address matches the value of the variable $(chat.email) (i.e., the email address entered in the chat widget). The results of the search are passed to the [[Scenario-builder-reference-guide/BrightPatternSearchObject#Recordset_name|Recordset name]] field, which we name ''email.RS''.[[File:Scenario-Pop-Case-2-53.PNG|800px|thumb|center|The Bright Pattern Search Object block searches for a matching email address]]Next, we add an [[Scenario-builder-reference-guide/If|If]] block and configure it with two [[Scenario-builder-reference-guide/If#Branches_and_Conditions|branches]]: ''Email Found'' and ''Email Not Found''; the purpose of this is to be able to dictate different actions depending on whether the email address was found or not. [[File:Scenario-Pop-Case-3-53.PNG|800px|thumb|center|The If block with two branches]]For the Email Found branch, add a [[Scenario-builder-reference-guide/If#Branches_and_Conditions|condition]] to check if the string ''email.RS'' (i.e., the recordset name from [[Scenario-builder-reference-guide/BrightPatternSearchObject|Bright Pattern Search Object]] contains a value (i.e, "is not empty").[[File:Scenario-Pop-Case-3a-53.PNG|800px|thumb|center|The If block's Email Found branch]]For the "Email Not Found" branch, add a condition to check if the string ''email.RS'' does not contain a value (i.e., "is empty").[[File:Scenario-Pop-Case-3b-53.PNG|800px|thumb|center|The If block's Email Not Found branch]]If a value was returned in the recordset name ''email.RS'' (i.e., the email address entered in the chat widget matches that of a saved contact), we want the cases associated with this contact to be popped to the agent from a [[Scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block.In this block, enter the following URL in the [[Scenario-builder-reference-guide/WebScreenPop#URL_of_the_page_to_open|URL of the page to open]] field: https://your_contact_center.brightpattern.com/agentdesktop/contact/currentcontact/casesFrom here, if the email address matches one associated with an existing contact, the cases associated with this contact will be popped to the available agent when the chat is connected. If not, no screen pop will occur. For more information on the types of URLs that can be popped, see section [[#Access_URLs|Access URLs]] in this article.[[File:Scenario-Pop-Case-4-53.PNG|800px|thumb|center|The Web Screen Pop block pops the cases associated with the found contact]]If no value was returned in ''email.RS'' (i.e., the email address entered in the chat widget does not match that of a saved contact), we want the customer to connect directly to an agent. To do this, we use a [[Scenario-builder-reference-guide/Goto|Goto]] block to jump ahead in the scenario to the [[Scenario-builder-reference-guide/FindAgent|Find Agent]] block.Finally, we are ready to pass the customer to an agent, whether they were identified or not. To do this, configure your scenario with the two most basic chat scenario blocks: [[Scenario-builder-reference-guide/FindAgent|Find Agent]] and [[Scenario-builder-reference-guide/ConnectChat|Connect Chat]]. For more information about these blocks, see [[Scenario-builder-reference-guide/HowtoCreateaBasicScenario|How to Create a Basic Scenario]]. As a reminder, define all [[Scenario-builder-reference-guide/ScenarioBuilderOverview#Conditional_Exits|conditional exits]]. [[File:Scenario-Pop-Case-7-53.PNG|800px|thumb|center|Find Agent and Connect Chat with defined conditional exits]]The following is a selection of URLs that can be used in the [[Scenario-builder-reference-guide/WebScreenPop|Web Screen Pop]] block to pop specific case and contact information.The following URL can be used to pop case information.The following URL can be used to pop contact information.