---
schema_version: "1"
id: 3476bf3e8fde5d8bb1d5878c172ed223840e1b6603790a319c620af37633d933
title: Create the prechat
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/service/264-0-0/omnichannel_create_variable_prechat.md
canonical_url: https://help.salesforce.com/s/articleView?id=service.omnichannel_create_variable_prechat.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 731f11fbbdcd30bbf0dff960b9af60f6f9da1d48ef3c01d0612c98dd9df41385
description: To build a flow that routes chats based on information captured in a pre-chat form, add a prechat record collection variable. Set up the variable to pull pre-chat details from the Conversation Context Entry object.
products:
  - Service Cloud
release: "264"
---
# Create the prechat

To build a flow that routes chats based on information captured in a pre-chat form, add a prechat record collection variable. Set up the variable to pull pre-chat details from the Conversation Context Entry object.

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small "><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;"><a href="https://help.salesforce.com/s/articleView?id=service.service_editions_reference.htm&amp;language=en_US" target="_blank">View supported editions</a>.</td></tr></tbody></table>

1. In the Flow Builder Toolbox, click **Manager** and then click **New Resource**.
2. For **Resource Type**, select **Variable**.
3. For **API Name**, enter prechatInfo.
4. For **Data Type**, select **Record**.
5. Select **Allow multiple values (collection)**.
6. For **Object**, select **Conversation Context Entry**.
7. Under **Availability Outside the Flow**, select **Available for input**.
8. Click **Done**.
    
    ![New variable resource named prechat.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support-264-0-0-production-enus/dd14551c-a772-4db6-9a1d-d84df8df2980/support/images/omnichannel/omnichannel_create_prechat_variable.png)

![Example](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support-264-0-0-production-enus/dd14551c-a772-4db6-9a1d-d84df8df2980/images/icon_example.png)

Example

You want to route chats based on the customer’s city. If the customer is from Chicago, then route the chat to the Chicago team. Otherwise, route it to a default queue. To automate this process before the chat begins, customers fill out a pre-chat form, where they provide their names and email addresses.

To use this pre-chat information in a flow, start by defining a pre-chat collection variable based on the Conversation Context Entry object. Then create a flow that loops through the pre-chat records to get the customer’s email address. If found, the flow gets the customer record from the Contact object based on the provided email address. Finally, the flow routes the chat to the Chicago team if the customer record city is Chicago. Else, it routes the chat to the default queue.

![The flow routes chats to the Chicago team or a default queue based on pre-chat information.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-service-support-264-0-0-production-enus/dd14551c-a772-4db6-9a1d-d84df8df2980/support/images/omnichannel/omnichannel_flow_with_prechat_variable.png)