Dynamically field type change not working

Feature(s) impacted

Forest Admin Smart Action should be able to change field type dynamically based on onChangeHook for other field.

Observed behavior

Requirement - We wanted to implement custom behaviour in Smart Action Field where it can allow user to select from predefined dropdown list or provide new value if existing list doesn’t suffice.
Created separate feature request - Need Editable Dropdown list for smart action - #2 by Nilesh_Shirsat

As I couldn’t find existing field which could fulfil this requirement, we have added workaround in project for now. This workaround works as below

  1. User will be present with existing predefined list in dropdown field. Type - [Enums]
  2. When User wants to enter new value for field, user can enable Custom Purpose field which is bydefault false.
  3. If Custom Purpose field is marked true, we are trying to change field type of dropdown to String.

Currently when field type is changed it still shows dropdown with unedited version.

Expected behavior

Expectation - We are expecting it to behave as text field and type is changed to string and vice versa for dropdown.

Please let us know if there is other way to achieve this behaviour without workaround. Else whether dynamically field type change can be improved.

Failure Logs

No Logs captured

Context

  • Project name: Curator
  • Team name: Developer
  • Environment name: ALL (Staging, Development, Production)
  • Agent type & version:
  • Package Version: 9.0.5 (forest-express-sequelize)
  • Express Version: 4.18.2
  • Sequelize Version: 6.3.0
  • Database Dialect: MySql

Hello @Nilesh_Shirsat ,

To achieve this behaviour, you have to remove the enum field and add a string field, instead of trying to change the type.
Here is the documentation on adding removing fields on dynamic forms: https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions/use-a-smart-action-form#add-remove-fields-dynamically