Dynamic smartaction form

Hey guys,

Is it possible to add a various number of fields (input) on a smartaction form, depending on custom conditions please ?

Thanks in advance for your response.

“sequelize”: “~5.15.1”
“forest-express-sequelize”: “^7.0.0”
“express”: “~4.17.1”
Lumber

Hi @nadiab !
It is possible as stated in the documentation ! It only works for single smart action tho !

1 Like

Or maybe you are talking about this feature, which is not available yet :sweat_smile:

1 Like

Hi,
Thanks for your your response
Yes it something like the feature which is not available, but I think that I can do something with the documentation you provided.
Thanks again.
Have a nice day

Hello,

I thought that I was able to do something with the documentation provided, but I’m kinda stuck :confused:
Here is what I am trying to do :
I want to custom my smart action fields by appending specific ones regarding the selected record.
Example :
If the selected record “type” is “VEGGIES” 3 more fields should appear on my smart action form.

I tried to update the smart action “fields” object on the hook part but nothing happened :

hooks: {
      load: async ({ fields, record }) => {
        fields.montant.value = record.amount;
        fields.commentaire.value = record.agentComment;
        if (record.type === "VEGGIES") {
          // append new fields 
          fields.newfield = {
            "value": null,
            "field": "newfield",
            "type": "String",
            "isRequired": false,
            "position": 3,
            "defaultValue": null,
            "description": null,
            "reference": null,
            "enums": null,
            "widget": null
          }
        }
        console.log(fields);
        return fields;
      }
    }

I displayed the fields object making sure that my new field “position” doesn’t conflict with the current ones.
Fields object is updated but no update on the smartaction…
Any idea ?

Thanks in advance for your help.

Hello @nadiab,

Adding or removing fields is not yet supported for now.
Fortunately, our team will work on this feature to make it available as soon as possible :+1:

Stay tuned,