How can I have multi-select option on dropdown using smart actions

Hi there!

I have a business case where I would need to select multiple items to apply a business rule. Is there a way to achieve this via smart actions? Details below

We have a discounts table where the agent can create a new discount record.

There is another table, where the agent would specify which units relate to the which discount record. For example, Discount ID 12 is associated with units 2, 8, 19, 200, etc. Ideally, when the agent is associating a discount ID, they should be able to link more than one unit at once (as demonstrated in the below wireframe)

Expected results:
The discount details in discount ID 12 will be applied to units 2, 8, 19 and 200.

Is there a way to achieve this multi-select unit option on smart action forms? If not, what possible alternatives would deliver similar result.

FYI, we are also considering to add a “add discounts” smart action to our unit collection. This way, from the summary view, an agent may select the unit IDs needed, then bulk apply a smart action - Add discounts. Though I’m not sure if this would work as expected.

Hello @Yusra_Bagosher,

Thanks for reaching out! :raised_hands:

I have two questions for you:

  • What is the relationship between discounts and units? Is there any a join table in your database units_discounts or are they linked direcly?
  • Did you consider using the native CRUD actions of Forest Admin to do what you want?
    Depending on your data structure, when creating or editing a discount, you should be able to access to the related data (units) and add exiting ones (or a new one).

And to answer your question about multi-select, if you have a field that is an array of strings for instance, you will be able to have an edit widget that allows you to select multiple choices (dropdown, checkboxes, etc). And this could be available in a smart action.

Let me know!