+ Start a Discussion
TerriKTerriK 

Documentation For Implementing the Live Agent Pre-Chat Form

Hello,
I've configured Live Agent to Work with the Custom Portal without using Sites, but the pre-chat form functionality is not working.  
Problem
The actual behavior is, when the customer clicks on the link to chat with a live agent and the live agent accepts, the customer is immediately able to chat with the live agent. 
Desired Behavior
The expected behavior is, when a customer clicks on a link to chat with a live agent and the live agent accepts the chat, the customer should complete a pre-chat form before proceeding to chat with the live agent. 
Resources
The pre chat form is created using examples provided by salesforce (I used the code in the example verbatim and I also tried using code from Pre-Chat form with some CSS.pdf). The visualforce page renders standalone, but it does not appear when the user clicks on a button.  The visualforce pages are associated with the customer portal user's profile.  I've used the example attached as well as the example in the official live chat developer's guide.  http://www.salesforce.com/us/developer/docs/live_agent_dev/index.htm.  The documentation does not provide enough information to implement the pre-chat form successfully.  
Another member from our team reviewed this issue and did not see where the javascript references the button and also believed the documentation is light.
Does the visualforce page only work with sites?  Is there an existing environment setup where this feature is working?  Do you have any sample pre-chat forms that use html/javascript instead of visualforce pages?
Thank you in advance for your help.  I have a video demonstrating the problem, if that will help  http://www.screencast.com/t/Xgv8EQDb4.
Best Answer chosen by Admin (Salesforce Developers) 
JonAnianoJonAniano

Hi Terri,

 

It looks like you've done everything mostly correctly, except, you will need to specify a "Site for Resources" in your button configuration in addition to specifying the pre-chat form visualforce page.

 

The reason for this is that the visualforce page must be served up via a site (because it could be unauthenticated) even if you're using customer portal.

 

Everything should work for you once you setup a site and choose the "Site for Resources" in your button setup.

 

Let me know how it goes! I'll see if we can make some efforts to update the documentation on this.


Thanks,

Jon 

 

 

All Answers

JonAnianoJonAniano

Hi TerriK,

 

In your button setup, have you selected the appropriate VF page in the "Pre-Chat Form" field on the button create/edit page?

 

Thanks,


Jon

JonAnianoJonAniano

Sorry Terri, I just watched the video. Looks like you might have that configured correctly. Give me some time to review the video in detail.

JonAnianoJonAniano

Hi Terri,

 

It looks like you've done everything mostly correctly, except, you will need to specify a "Site for Resources" in your button configuration in addition to specifying the pre-chat form visualforce page.

 

The reason for this is that the visualforce page must be served up via a site (because it could be unauthenticated) even if you're using customer portal.

 

Everything should work for you once you setup a site and choose the "Site for Resources" in your button setup.

 

Let me know how it goes! I'll see if we can make some efforts to update the documentation on this.


Thanks,

Jon 

 

 

This was selected as the best answer
TerriKTerriK

Thank you Jon!  It works now.

GCDevGCDev

Hi Terri,

 

I'm curious to know how you set up your site.com.

 

I have set my force.com site and am able to see the pre-chat screen, but once I complete the form and "request chat", I get the following message:

 

Your chat request has been canceled because no agents are available.

 


Obviously, I have the Live Agent Console running but I never get the request to start the chat.

 

Any ideas would be great to hear.

 

Thanks.

Huma ZafarHuma Zafar

Hello i am using pre-chat form using below code

 

<apex:page showHeader="false">
<!-- This script takes the endpoint URL parameter passed from the deployment page and makes it the action for the form -->
<script type="text/javascript">
(function() { function handlePageLoad() {
var endpointMatcher = new RegExp("[\\?\\&]endpoint=([^&#]*)");
document.getElementById('prechatForm').setAttribute('action',decodeURIComponent(endpointMatcher.exec(document.location.search)[1]));
} if (window.addEventListener) {
window.addEventListener('load', handlePageLoad, false);
} else { window.attachEvent('onload', handlePageLoad, false);
}})();
</script>
<h1>Pre-chat Form</h1>
<form method='post' id='prechatForm'>
Name: <input type='text' name='liveagent.prechat.name' id='prechat_field' /><br />
Email Address: <input type='text' name='liveagent.prechat:Email' /><br />
Department: <select name="liveagent.prechat.buttons">
<option value="573g00000004CBs">Customer Service</option>
<option value="573g00000004CCM">Technical Support</option>
<option value="573a00000000001,573a00000000002">Customer Service if online, otherwise Technical Support</option>
</select><br />
<!-- Creates an auto-query for a matching Contact record’s Email field based on the value of the liveagent.prechat:Email field -->
<input type="hidden" name="liveagent.prechat.query:Email" value="Contact,Contact.Email" />
<input type="hidden" name="liveagent.prechat.save:Email" value="Email__c" />
<input type='submit' value='Request Chat' id='prechat_submit'/>
<style type="text/css">
p {font-weight: bolder }
</style>
</form>
</apex:page>

 

can you please guide me how can i redirect this pre-chat form to the chat window.

 

quick response is needed.

 

Thanks

ArtemArtem

Same issue here.

Pre-chat from appears fine, but as soon as the end user fills in the form and presses the "Request Chat" btton, the error message "Your chat request has been canceled because no agents are available" appears. 

 

Any ideas?

Thanks.

Huma ZafarHuma Zafar

Hey, 

 

please ask your agent to open live agent console and then try it, it works!

viswadaviswada

HI  Terri,

 

               I have the same problem exactly  what you  have faced  inearlier. I am using    customer portal  instead of  .sites. I can i resove this  issues  without out sites  .because i don't have any force.sites 

viswadaviswada

HI  Terri,

 

               I have the same problem exactly  what you  have faced  inearlier. I am using    customer portal  instead of  .sites. I can i resove this  issues  without out sites  .because i don't have any force.sites 

bk-cvltbk-cvlt

We are running into this same issue where we have the vforce page configured and correctly tied to the Site for resources, however when the customer clicks request chat, we have the same error that no agents are available.  And similarly we have the live agent running and a rep online.  Does anyone know what may be causing the issue? 

ArtemArtem

Hi bk-cvlt,

 

As far as I remember I was able to fix the issue when I realized that the button I was using was incorrect. I originally used the template provided by SF (http://www.salesforce.com/us/developer/docs/live_agent_dev/index.htm), but only left one option in the Department field, Customer Service, and did not change the corresponding value. As you can see it is set to 573a00000000001, but you need to change it to the code form you button page. It will be similar in format but will end differently. 

 

Please let me know if this helps.

bk-cvltbk-cvlt

This did the trick, thank you very much.