Pre-chat fields can be saved as an object as opposed to array

Created on 15 May 2025, about 1 month ago

Problem/Motivation

The configuration schema for pre-chat fields is a sequence, which requires the saved configuration keys to be in sequential order, i.e 1,2,3,4,5. If the pre-chat field configuration is saved out of order, such as 1,2,3,5,6 which can happen if a field is removed, it will cause the configuration to be saved as an object.

Steps to reproduce

Add a new salesforce_mfw block to the site. Provide 3 prechat fields 'a', 'b', and 'c'. Export configuration and the configuration looks as followed:

prechat_fields:
    -
      name: a
      default_value: ''
      hidden: false
      editable_by_user: false
    -
      name: b
      default_value: ''
      hidden: false
      editable_by_user: false
    -
      name: c
      default_value: ''
      hidden: false
      editable_by_user: false

Edit the block again and remove "B" field and save.
Re-export configuration and the configuration now appears as:

prechat_fields:
    0
      name: a
      default_value: ''
      hidden: false
      editable_by_user: false
    2
      name: c
      default_value: ''
      hidden: false
      editable_by_user: false

Proposed resolution

Reset the pre-chat field configuration by calling array_values so that the keys will always be reset in order.

πŸ› Bug report
Status

Active

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States kyleleber

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024