+ Start a Discussion
Wolfgang FernandesWolfgang Fernandes 

Get parameters via URL using Live Agent - SalesForce

How to retrieve and pass parameters via url using live agent ? Using the Add Custom Detail I can recover only one parameter. Someone even used this requirement? If you can help, thank you ! 
pconpcon
Where are you trying to get the URL parameters from? Can you please include the code that you are currently using?

NOTE: When adding code please use the "Add a code sample" button (icon <>) to increase readability and make it easier to reference.
Wolfgang FernandesWolfgang Fernandes
<script type='text/javascript'>
liveagent.addCustomDetail('Email', 'wolf@test.com');
liveagent.addCustomDetail('cod', '123456');

liveagent.init('https://d.la2c1cs.salesforceliveagent.com/chat', '572e00000004CQ4', '00De0000005W2ot');
</script>

Prechat on the screen where the agent has the live button I have the following code : 
I'm going hardcoded because I have no information on the previous screen but I'm aware que the url will come fitted with the values. I would like know how do to recover them.
pconpcon
I have found that just adding the custom detail doesn't really do much.  It's better to map that to some data and / or save it to your transcript.  For example:
 
liveagent.addCustomDetail('Email', 'wolf@test.com').map('Contact', 'Email', false, false, false);
liveagent.addCustomDetail('Launch Code', '123456').map('Contact', 'LaunchCode__c', false, false, false).saveToTranscript('LaunchCode__c');

With the above it'll map that data to your Contact object and the field Email, LaunchCode__c and with the saveToTranscript method, it will save it to the LaunchCode__c field on the Transcript object.
Wolfgang FernandesWolfgang Fernandes
Got it. I agree, will be more assertive because the mapping of object fields in which I will save soon after. Got it. I agree, will be more assertive because the mapping of object fields in Which I will save soon after. This Email and Launch Code would have to be picked up dynamically according to the last parameter in via url in a previous screen. I wonder if this can be done.