.setCustomField()
(Last Updated On: May 4, 2017)
Overview

Pre-populate any field on your Pre-Chat or Offline form. (The field is still editable by the Visitor.)

SnapEngage.setCustomField(fieldName, fieldValue);

 

For Design Studio users only. Legacy chat users may instead use the .setDescription(), .setUserEmail(), or .setUserName() API methods to pre-populate their non-custom form fields. Custom form users will be able to pre-populate any custom fields on their forms by simply using JavaScript, for example, document.getElementById(“myFavoriteColor”).value = “blue”.


Parameters


fieldName
Type
String | (Required)
The field’s name attribute. Case-sensitive.
Description
The field’s name attribute can be found by inspecting the DOM and looking for the input element’s name attribute. In general the name of a field is the field’s label with no spaces, and case-sensitive. For example, if you have a field with a label “Favorite Color”, the name attribute is “FavoriteColor”.

fieldValue
Type
String | (Required)
Description
Provide a value for this field.
You can hardcode the value, or pass it as a parameter using JavaScript or server-side scripting.