Use the findOrCreate method to find existing records or create records based on certain criteria.
Usage
Finds or creates a record of the specified type when a chat is routed by Omni-Channel or when an agent accepts a chat request that is routed by Live Agent routing. For chats routed by Omni-Channel, the findOrCreate code triggers even if the chat visitor cancels the chat before the agent accepts. For chats routed by Live Agent routing, the code triggers only when an agent accepts the chat request.
The findOrCreate method begins the API call that finds existing records or create records when an agent begins a chat with a customer. Use this method before calling any of the other findOrCreate submethods for finding or creating records with the Deployment API.
Note
Available in API versions 29.0 and later.
Limitations
For security reasons, this API is disabled by default on new orgs. You can enable this feature from the Chat Settings page in Setup. This page also allows you to create an allowlist for allowed objects.
If this feature is enabled and no objects are selected in the allowlist, all valid objects are allowed.
Note
Implement the findOrCreate call in an agent session and not a bot session. If findOrCreate matches multiple records, the agent can choose which record to attach but the bot doesn’t have a way of doing that.
Other limitations:
For find, we don’t allow finding profiles or permission sets.
For create, we don’t allow creating profiles or permission sets.
Syntax
liveagent.findOrCreate(String EntityName)
Parameters
Name
Type
Description
Available Versions
EntityName
String
The type of record to search for or create when an agent accepts a chat with a customer—for example, a contact record.