Example: Create a case with the value "Chat" as Origin.
<input type='hidden' name='liveagent.prechat:caseorigin' value='Chat'/>
<input type='hidden' name='liveagent.prechat:caseContactId' value='{!$User.ContactId}'/>
<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Origin,caseorigin;ContactId,caseContactId;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Origin,true;ContactId,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="Case" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />
UPDATE: I discovered the field names are case-sensitive.
UPDATE: I have updated the example to show how to add multiple fields.
You are using the deployment API which is different to the tags that must be used in the pre-chat form.
Here is an example on how to create a case with some information pre-populated that will also show in the console for the agent, you can do the same without creating a record, this should give you an idea.
<input type='hidden' name='liveagent.prechat:caseorigin' value='Chat'/>
<input type='hidden' name='liveagent.prechat:caseContactId' value='{!$User.ContactId}'/>
<input type="hidden" name="liveagent.prechat.findorcreate.map:Case" value="Origin,caseorigin;ContactId,caseContactId;" />
<input type="hidden" name="liveagent.prechat.findorcreate.map.doCreate:Case" value="Origin,true;ContactId,true;" />
<input type="hidden" name="liveagent.prechat.findorcreate.saveToTranscript:Case" value="Case" />
<input type="hidden" name="liveagent.prechat.findorcreate.showOnCreate:Case" value="true" />
The section you care about if all you want is to show the details on the console would be this
<input type='hidden' name='liveagent.prechat:caseContactId' value='{!$User.ContactId}'/>
in combination with this value
<input type= "hidden" name= "liveagent.prechat.findorcreate.displayToAgent:caseContactId" value= "true" />
With that, you are assigning a value to a custom chat detail that will be shown to the agent that gets the chat assigned.
Best Answer
Yes It's possible...but if custom field is text-area...long text area..rich text area...will not supported in pre-chat here....