Can not set default values in bulk smart actions

Expected behavior

There is an opportunity to set default values (though values, load hook, defaultValue or anything else) in bulk actions.

Actual behavior

After upgrading from 7.5.1 to 7.9.6 version all defaultValue in .forestadmin-schema.json are ignored. And for bulk actions there seems to be no other choice of setting default values.

Context

  • Package Version: 7.9.6
  • Express Version: 4.17.1
  • Sequelize Version: 5.22.3
  • Database Dialect: mysql
  • Database Version: 5.7.30 (local)
1 Like

Hi @Tatsyana_Slabodchyka and welcome in our community :champagne: !

All the default values of your collections’ fields or your smart actions’ fields ?

You say you upgraded to 7.9.6 but the latest version of forest-express-sequelize is 6.7.7. So what package are you talking about :sweat_smile: ?

All the default values of your collections’ fields or your smart actions’ fields ?

Smart actions’ fileds

So what package are you talking about :sweat_smile: ?

Sorry, about forest-express package. But actually I upgraded forest-express-sequelize from 6.3.15 to 6.7.6 - and experienced the issue.

Could you please share an action with those default values and the .forestadmin-schema.json part that correspond to that action :pray:

Action:

{
    name: 'Test action',
    endpoint: 'endpoint',
    type: 'bulk',
    fields: [
      {
        field: 'force',
        type: 'Boolean',
        isRequired: true,
        defaultValue: false,
      },
      {
        field: 'Send Email',
        description: 'send email to owner',
        type: 'Boolean',
        isRequired: true,
        defaultValue: true,
      },
    ],
  },

.forestadmin-schema.json

{
      "name": "Test action",
      "type": "bulk",
      "baseUrl": null,
      "endpoint": "endpoint",
      "httpMethod": "POST",
      "redirect": null,
      "download": false,
      "fields": [{
        "field": "force",
        "type": "Boolean",
        "defaultValue": false,
        "enums": null,
        "isRequired": true,
        "reference": null,
        "description": null,
        "position": 0,
        "widget": null
      }, {
        "field": "Send Email",
        "type": "Boolean",
        "defaultValue": true,
        "enums": null,
        "isRequired": true,
        "reference": null,
        "description": "send email to owner",
        "position": 1,
        "widget": null
      }],
      "hooks": {
        "load": false,
        "change": []
      }
    },

This action on UI: 6.3.15 vs 6.7.6
6.3.15 6.7.6

Hi @Tatsyana_Slabodchyka,

Thanks a lot for the report.
You are perfectly right, we can reproduce it on our side. We are working on a fix, we’ll let you know when it’s corrected.
Meanwhile, if this is something blocking to you, I recommend to downgrade to 6.3.15 to keep the same behaviour as before.

Finally, did you hear about the Dynamic Form Hooks we launched?
That could do the trick for you. Here is information about it.

Thanks!

Hooks don’t work with bulk actions, but defaultValue does (or did at least :slightly_smiling_face:)
Anyway, thank you! Waiting for the update

1 Like

Hello @Tatsyana_Slabodchyka,

We support anew the defaultValue for fields in smart action, even if your forest-express-sequelize version is >= 6.6.0.

Please give it a try and tell me if everything is ok :slight_smile:

2 Likes

Great! It is working now :star_struck:

2 Likes