+ Start a Discussion

Live agent deployment code passing parameter issue

I am trying to pass a paramter into live agent deployment code like 
liveagent.init('https://XXXX.salesforceliveagent.com/chat', '572b0000000xxxs&lang=en&country=international_Support_EN', 'xxxxxxxxxxxxx');
passing parameter like "&lang=en&country=international_Support_EN"  works fine in production environment however when im adding parameters in deployement code of sandbox its not working.
Is anyone else also facing same issue and anyone knows a workaround for it ?
Have you tried using the addCustomDetail to set this instead of adding it like that to your init?  Page 12 of the PDF [1]

[1] https://resources.docs.salesforce.com/sfdc/pdf/live_agent_dev_guide.pdf

Thanks @pcon,
I know we can use addCustomDetail to pass parameters as stated in doc https://resources.docs.salesforce.com/sfdc/pdf/live_agent_dev_guide.pdf

but in our current functionnality in production, we are already using an option of passing parameters from deployment api like this liveagent.init('https://XXXX.salesforceliveagent.com/chat', '572b0000000xxxs&lang=en&country=international_Support_EN', 'xxxxxxxxxxxxx');
and its working fine there however its not working for sandbox deployment API

Is your sandbox the same API verison as your production instance?  Has this ever worked in your sandbox or is this a new failing?
Joe BohonJoe Bohon
liveagent.init('https://d.la1s1.salesforceliveagent.com/chat', '579900000004CBx', '00Dn99008008fSQ&userName={!usr.Name}&userEmail={!usr.Email}');
We have the same issue. It stopped working in Production and all Sandboxes. If you find a solution, please post it.

@joe Bohon,

What I know Salesforce in its recent release stop allowing passing paramters with liveagent deployment id and thats causing this problem. 

Solution for is to use "addCustomDetail" to pass parameters from pre-chat form.

Joe BohonJoe Bohon
I was able to solve our problem by binding the Name and Email directly and not pass the parameters through the URL itself.

u = [SELECT Name, AccountID, Email FROM User WHERE Id = :Userinfo.getUserId()];
 //nameOfUser = userInfoMap.get('userName');  <this code no longer works
 //emailOfUser = userInfoMap.get('userEmail');
        nameOfUser = u.Name;
        emailOfUser = u.Email;

I also noticed that our custom chat page with the buttons and the pre-chat page were different URLs. For example, our button page is https://mycompany-name.force.com/support/apex/ChatPage and our pre chat page was opening as https://mycompanyname.force.com/support/apex/PreChat
To overcome the issue where it was returning the guest user info (instead of the actual user logged in) into the Name and Email fields on the prechat page, I removed the Pre-Chat Form Page setting and added the Pre-Chat Form URL of https://mycompany-name.force.com/support/apex/PreChat. These are the settings in the Custom Buttons and Automated Invitations section under Live Agent.

This forced the prechat page to use the same domain for both pages and the variables passed with no problems.
Hope this helps someone else who has the URL hack in place and it is not working.