Skip Navigation
Expand
Passing custom fields from a chat launch URL to a resulting chat and incident
Answer ID 7878   |   Last Review Date 10/04/2024

How I pass custom fields from a chat launch URL to a resulting chat and incident?

Environment:

Applies to Customer Portal 3.x and higher.

Resolution:

On the chat launch page, there are three widgets involved in passing custom fields to the chat landing page:  CustomAllInput, FormInput and ChatLaunchButton.

When you want to pass custom fields to the chat workspace from the end user page, the custom fields need to be defined on the chat_launch page.  If the fields are not going to be displayed to the end user, they can be hidden.  CustomAllInput displays all contact custom fields on customer entry forms, and displays all incident custom fields on the Ask a Question page (refer to Answer ID 6543: Contact Fields on the Chat Launch Form for additional details). 

The widgets contained in the chat launch page that are associated with this functionality are as follows:

  • CustomAllInput
    This widget is used to display all custom fields passed in the page URL. Surrounding this widget with div tags using class=”rn_Hidden” will allow the custom fields to be passed without displaying them on the chat launch form.
  • FormInput
    You can choose to include the custom fields one by one.  For example:
    <rn:widget path="input/FormInput" name="Incidents.c$severity_level" required="true"/>

NOTE :

While testing in development mode for Customer Portal you might be having the below error message:

Widget Error: standard/input/SelectionInput - 'Incidents.c$severity_level' is a read-only field and cannot be used with an input widget.

This is because custom fields need to have edit permissions for end users in order to be utilized within the widget. In order to correct this, you will need to edit the specific custom field and check the 'Edit' checkbox.

  • ChatLaunchButton
    This widget is involved in submitting the chat launch form and sending the appropriate fields and values – including custom fields – to the chat landing page. If you want to send custom fields without displaying them on the page, you can hide the CustomAllInput or the FormInput widget (as described above) from the chat launch page and add the custom fields to the widget as an attribute (non-Engagement Engine sites) as such:

    ...
        RightNow.Client.Controller.addComponent(
            {
                container_element_id: "myChatLinkContainer",
                enable_availability_check: true,
                ignore_preroute: true,
                custom_fields: "{\"9\":\"TEST\"}",
     ...

    Where "9" is the custom field ID, and "TESTVALUE" is the value to be set to field 9.