Direct-To-Agent chats fail if a prechat page is used on the button
Trailblazer Community

Direct-To-Agent chats fail if a prechat page is used on the button

Live Agent

Last updated 2018-01-09 ·Reference W-3422644 ·Reported By 10 users

No Fix - Summer '18

When a page is configured to route chats directly to a specific agent, but the button on that page has a prechat page configured on it, the chat window will show the error "The chat window may only be launched from a button -- you cannot access it directly." when it opens (before prechat is displayed).

-Configure an org with live agent, a chat button, and an agent that can take chats from that button.
-Configure the button with a prechat page, doesn't matter what the content of that page is.
-Configure the web page that hosts the deployment and chat button to use the agent id of your agent in the showWhenOnline, showWhenOffline, and startChat calls. For example:
Direct to agent
<a id="liveagent_button_online_573xx0000000001" href="javascript://Chat" style="display: none;" onclick="liveagent.startChat('573xx0000000001', '005xx000001Svrk', false)">Online Chat Content</a><div id="liveagent_button_offline_573xx0000000001" style="display: none;">Offline Chat Content</div><script type="text/javascript">
if (!window._laq) { window._laq = []; }
window._laq.push(function(){liveagent.showWhenOnline('005xx000001Svrk', document.getElementById('liveagent_button_online_573xx0000000001'));
liveagent.showWhenOffline('005xx000001Svrk', document.getElementById('liveagent_button_offline_573xx0000000001'));

-Make your agent available, and click to chat. You'll see the error in the chat window that pops up.
-Removing the prechat page from the button makes the chat request successful.

-Remove the prechat page from the button
-Change the page to route to the button instead of the agent.

Any unreleased services, features, statuses, or dates referenced in this or other public statements are not currently available and may not be delivered on time or at all. Customers who purchase our services should make their purchase decisions based upon features that are currently available.