1

So we're using the liveagent.findOrCreate Deployment APIs to initiate our Live Agent Chats. We are not calling the liveagent.prechat versions and are having issues finding already existing Accounts.

Our example is very much like the Salesforce Code Example found here: Code sample

Setup:

  • Live Agent Deployment with Omni Channel Routing

Scenario:

Omni routing works to push the Chat Transcript to the correctly signed in agent for that Queue; however, everytime, the Chat Transcipt loads, and a new Account is created, even when the Account already exists.

Here is the code:

liveagent.setName(profile.firstName + ' ' + profile.lastName);
liveagent.addCustomDetail('Email', profile.email);
liveagent.findOrCreate('Contact').map('Email','Email',true,true,true); 

liveagent.findOrCreate('Contact').saveToTranscript('ContactId').showOnCreate().linkToEntity('Case','ContactId');
liveagent.addCustomDetail('Case Subject','Live chat');
liveagent.findOrCreate('Case').map('Subject','Case Subject',false,false,true).saveToTranscript('CaseId').showOnCreate();
liveagent.addCustomDetail('Account name', profile.establishment.companyName);
liveagent.findOrCreate('Account').map('Name','Account name',false,false,true).saveToTranscript('AccountId').showOnCreate().linkToEntity('Case','AccountId');

Thoughts? Much appreciated.

2

liveagent.findOrCreate('Account').map('Name','Account name',false,false,true) in your code does not find the existing records.

liveagent.findOrCreate('Account').map('Name','Account name',true,true,true) tries to match the name given to the existing Account Names and opens the existing ones (if any)

It is similar to contact you created/ found using email in your code. Please try the similar approach with Account using the name. Implementation of exact searching records(do for accounts) is shown in the link you posted:: https://developer.salesforce.com/docs/atlas.en-us.live_agent_dev.meta/live_agent_dev/live_agent_creating_records_code_sample.htm

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.