# Load hook is not firing / working on smart action

**URL:** <https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102>\
**Category:** Help me!\
**Tags:** setup\
**Created:** [March 15, 2021, 12:23pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102 "2021-03-15T12:23:03Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 15, 2021, 12:23pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/1 "2021-03-15T12:23:04Z")

</div>

## Expected behavior

On a smart action get the load hook to kick in on load. It’s not happening. Not setting value, nor printing log, nor stopping at break point.

## Actual behavior

It’s not being fired so it is as it’s not being defined.

## Failure Logs

no failure log when opening smart action on UI. It’s showing the action. It’s loading it but the fields of enum are still empty so no option showing on dropdown.

## Context

This is the smart action with the load hook setup

```javascript
{
  name: 'lorem',
  endpoint: '/forest/actions/add-lorem',
  type: 'bulk',
  fields: [
    {
      field: 'select items',
      type: 'Enum',
      enums: [],
    },
  ],
  hooks: {
    load: async ({ fields, record }) => {
      console.log('not being executed')
      return fields
    },
  },
}

```

## Setup

- Package Version: “forest-express-sequelize”: “^6.7.11”
- Express Version: “express”: “~4.16.3”
- Sequelize Version: “sequelize”: "~5.15.1
- Database Dialect: “postgres”
- Database Version: “pg”: “^8.5.1”

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cisco](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaume_cisco/32/918_2.png) [@Guillaume\_Cisco](https://community.forestadmin.com/u/Guillaume_Cisco)\
**Post date:** [March 15, 2021, 12:29pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/2 "2021-03-15T12:29:17Z")

</div>

Hello @rofi, and welcome to the Forest Admin community 🎉

Load hook only works with single smart action. The `bulk` type is not supported yet.  
You can read the [documentation](https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions#making-a-form-dynamic) to find more information about this feature 🙂

I hope it helps you 🙂

---

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 15, 2021, 1:06pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/3 "2021-03-15T13:06:48Z")

</div>

Hey @Guillaume_Cisco . Yes, it answers my question thanks. But I got you another one 🙂 Is there a workaround or other approach to pickup async data for bulk actions? Seems like a normal use case.

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cisco](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaume_cisco/32/918_2.png) [@Guillaume\_Cisco](https://community.forestadmin.com/u/Guillaume_Cisco)\
**Post date:** [March 15, 2021, 1:17pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/4 "2021-03-15T13:17:51Z")

</div>

Yes @rofi,

You can still use the deprecated feature `values`, check [this part in the old documentation](https://docs.forestadmin.com/documentation/v/v5/reference-guide/actions/create-and-manage-smart-actions#prefill-a-form-with-default-values) 🙂

---

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 15, 2021, 2:29pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/5 "2021-03-15T14:29:16Z")

</div>

to use it I need to downgrade to v5 @Guillaume_Cisco ? It’s not picking up on v6.

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cisco](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaume_cisco/32/918_2.png) [@Guillaume\_Cisco](https://community.forestadmin.com/u/Guillaume_Cisco)\
**Post date:** [March 15, 2021, 2:45pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/6 "2021-03-15T14:45:05Z")

</div>

You don’t need to downgrade to v5, you can still use it, but you will have a warning message.

---

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 15, 2021, 3:39pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/7 "2021-03-15T15:39:41Z")

</div>

So `values` is only working for single smart actions too 😢 Any thoughts @Guillaume_Cisco ?

---

<div class="post-metadata">

**Author:** ![Guillaume\_Cisco](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/guillaume_cisco/32/918_2.png) [@Guillaume\_Cisco](https://community.forestadmin.com/u/Guillaume_Cisco)\
**Post date:** [March 15, 2021, 3:57pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/8 "2021-03-15T15:57:19Z")

</div>

Indeed, `values` will also work with single smart actions.  
As a workaround, you could use `defaultValue` for each field. It won’t be dynamic, but will allow you to declare basic default values for your fields.

Let me know if it helps 🙂

---

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 15, 2021, 5:50pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/9 "2021-03-15T17:50:31Z")

</div>

I think the answer is that ForestAdmin lacks full bulk editing capabilities. Not seeing a workaround here. Thanks anyway @Guillaume_Cisco for the help.

---

<div class="post-metadata">

**Author:** ![anon39848301](https://avatars.discourse-cdn.com/v4/letter/a/b9e5f3/32.png) [@anon39848301](https://community.forestadmin.com/u/anon39848301)\
**Post date:** [March 16, 2021, 8:53am UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/10 "2021-03-16T08:53:41Z")

</div>

Hi @rofi.

I pushed this as an insight on our ProductBoard, since the current load hooks is not designed to work on bulk smart action.

---

<div class="post-metadata">

**Author:** ![rofi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/rofi/32/1792_2.png) [@rofi](https://community.forestadmin.com/u/rofi)\
**Post date:** [March 16, 2021, 1:00pm UTC](https://community.forestadmin.com/t/load-hook-is-not-firing-working-on-smart-action/2102/11 "2021-03-16T13:00:23Z")

</div>

Great @anon39848301 . I don’t know the constraint on not letting the hook be called on bulk. Surely there is a why. In my case, I want to on load set an enum with an async query for a database collection. Putting it here just to see if you think there is another way to do this. To close all options. But that functionality seems to be off-limits without the hook.
