This is a template you must use to report issues.
Feature(s) impacted
We need to add a checkbox based on the dropdown option (considered for option ‘A’). When we select the option ‘A’ from the dropdown then it is working properly. But when we select another option and select option ‘A’ again then the checkbox is again added in forest admin which is expected.
But when we submit the smart action form we are getting undefined parameters while logging therequest.body.data.attributes.values
object. Also, it displays messages like ‘A value is required for undefined field’
Observed behavior
When we submit the smart action form we are getting an undefined field name for the dynamically added field while logging the
request.body.data.attributes.values
object. Also, it displays messages like ‘A value is required for undefined field’
Expected behavior
Forest admin smart action should persist the dynamically added fields name and its value.
code for change hooks as below
change: {
onProductChanged: async (
/** @type {any} */ { fields, changedField }
) => {
if (changedField.value === 'A') {
fields.push({
field: 'checkboxName',
type: 'Boolean',
isRequired: true,
});
} else {
fields.splice(
fields.findIndex((item) => item.field === 'checkboxName'),
1
);
}
return fields;
},
},
},
Failure Logs
A value is required for an undefined field message in FA prompt.
Context
Please provide in this mandatory section, the relevant information about your configuration:
- Project name: Curator
- Team name: Developer
- Environment name: ALL (Staging, Development, Production)
- Agent type & version:
- Package Version: 8.3 (forest-express-sequelize)
- Express Version: 4.17.1
- Sequelize Version: 6.6.5
- Database Dialect: MySql