This question is a follow-on to my previous question: LiveAgent Chat with External ID
I am trying to pass in a Contact external ID from a non-Salesforce web page and use that to look up the Contact and display its name in the Live Agent window. Specifically, the Live Agent's chat window in Salesforce, not the client.
I am using the Live Agent deployment API which is the JavaScript-based API that sets up the chat from the client end and makes the connection to Salesforce.
Below is the JavaScript code which looks up the Contact
record, maps the external ID, and initializes the chat. What is missing is "get the Name
field from the Contact
." I know I can use liveagent.setName()
to put a string in the Live Agent window, but I need help getting the name from the contact first so I can marshal that value into the next API call.
<script type="text/javascript">
var extId = ...;
liveagent.addCustomDetail('External_ID__c', extId);
liveagent.findOrCreate('Contact').map('External_ID__c', 'External ID', true, true, false);
/* I need to get the Contact.Name field from the Contact record here */
liveagent.setName('???');
liveagent.init('https://XXXXXXX.salesforceliveagent.com/chat', 'XXXXXXXXXXXXXXX', 'XXXXXXXXXXXXXXX');
</script>
Contact
? If that's the case, it would appear you're either asking how to run a query to Salesforce based on passingExternal_ID__c
into the page by creating a JS function to do that, or else how to configure a controller of some kind to return theContact
usingExternal_ID__c
as the input. Would that be the essence of what you're asking? If so, you may want to edit your question to clarify it.