preChatFieldValueProvider
A provider for pre-populating visible pre-chat field values before the form is displayed.
Set this lambda to supply default values for pre-chat fields that the end user can see and edit. The lambda receives the list of PreChatFields configured in the deployment and should return the same list with PreChatField.userInput populated as needed.
Set to null to disable pre-population (the default).
Important: Hold a strong reference to this provider for the lifetime of the UIClient. If the provider is a local variable or a weakly-referenced object, it may be garbage collected and pre-chat population will silently stop working.
See also
for hidden values used in routing
Samples
uiClient.preChatFieldValueProvider = { fields: List<PreChatField> ->
fields.onEach { field ->
when (field.name) {
"FirstName" -> field.userInput = "Jane"
"LastName" -> field.userInput = "Smith"
"Email" -> field.userInput = "jane@example.com"
}
}
}Content copied to clipboard