function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
FinnArildFluidoFinnArildFluido 

Live Agent pre-chat forms that store value to transcript

A customer of ours wants to have a field filled in from the user in the pre-chat form stored to the transcript. I get the field in fine, but it isn't stored to the Live Chat Transcript object I have tried several things but it just don't want to stick. Below is my current pre-chat form. The custom field I want to have saved to is (obviously) subject__c- does someone know a way to do this?

 

<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"> 
      Mitt telefonnummer: <br />
<input type="text" name="liveagent.prechat:phone" /><br /> 
      Mitt kundenummer: <br />
<input type="text" name="liveagent.prechat:kundeident" /><br /> 
      Min henvendelse gjelder: <br />
<input type="text" name="liveagent.prechat:subject" id="prechat_field" /><br /> <br />
      
      
      <!-- Creates an auto-query for a matching Contact records Email field based on the 
      value of the liveagent.prechat:Email field -->    
      <input type="hidden" name="liveagent.prechat.query:phone" 
      value="Account,Account.Phone" /> 
      <input type="hidden" name="liveagent.prechat.query:kundeident" 
      value="Account,Account.Email" /> 
      <input type="hidden" name="liveagent.prechat.save:subject" value="LiveChatTranscript, LiveChatTranscript.subject__c" /> 
      <input type="submit" value="Request Chat" id="prechat_submit"/> 
<style type="text/css"> 
p {font-weight: bolder } 
</style> 
</form> 
</apex:page>

 

JconsultantJconsultant


Try this.  

 

<input type="hidden" name="liveagent.prechat.save:Subject" value="Subject__c" />  

 

The liveagent transcript object is implied.  You just have to reference the field name directly.

Thomas RasmussenThomas Rasmussen

Did you create subject__c as a field in the transcript?

JconsultantJconsultant

It appeared that he had created a subject__c field on the transcript object.  The part that needed to be updated was the fact that the .save is different than the .query.  The .save just needed the field name on the transcript object.  I hope that helps.