# Smart Action On All Filtered Records

**URL:** <https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410>\
**Category:** Help me!\
**Tags:** howtos, smart-action\
**Created:** [June 17, 2023, 11:18am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410 "2023-06-17T11:18:00Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arda\_Yurdakul](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arda_yurdakul/32/2334_2.png) [@Arda\_Yurdakul](https://community.forestadmin.com/u/Arda_Yurdakul)\
**Post date:** [June 17, 2023, 11:18am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410/1 "2023-06-17T11:18:00Z")

</div>

Hey Forest,

We are trying to build a smart action that will involve up to a few thousand records at once. Basically we want the ability to filter a table using the default Forest filters and then run this global action and once we do, somehow have a list of all of the ids of the filtered records available similar to `req.body.data.attributes.ids`. I feel as though this should be possible as Forest provides similar behavior in the default export route as it exports all currently filtered records.

How can we achieve this behavior in the context of a smart action?  
Thank you!

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [June 19, 2023, 8:41am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410/2 "2023-06-19T08:41:46Z")

</div>

Hi @Arda_Yurdakul 👋 !

I’m sorry but I did not understood your usecase 😅.  
You want to filter a table view ? Or to trigger an action that will apply only on some records ?

---

<div class="post-metadata">

**Author:** ![Arda\_Yurdakul](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arda_yurdakul/32/2334_2.png) [@Arda\_Yurdakul](https://community.forestadmin.com/u/Arda_Yurdakul)\
**Post date:** [June 19, 2023, 9:14am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410/3 "2023-06-19T09:14:26Z")

</div>

Hi @anon62739609 !

Here is the flow we want to achieve in one specific table we have:

1. We have a table of Users
2. We apply some filters on it and are left with around 2-3 thousand records
3. We execute a global action
4. Within the context of the post route of the action we have a list of all the ids of the currently filtered records mentioned above
5. We use said list to execute some logic

---

<div class="post-metadata">

**Author:** ![anon62739609](https://avatars.discourse-cdn.com/v4/letter/a/c2a13f/32.png) [@anon62739609](https://community.forestadmin.com/u/anon62739609)\
**Post date:** [June 19, 2023, 9:36am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410/4 "2023-06-19T09:36:54Z")

</div>

Okey so it just looks like you should do a bulk action.  
If you do:

- A `bulk` action
- Select all records ()
- Use the `getIdsFromRequest` ([Documentation here](https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions))

```javascript
const recordsGetter = new RecordsGetter(companies, request.user, request.query);
return recordsGetter.getIdsFromRequest(req)
  .then(ids => { ... });

```

---

<div class="post-metadata">

**Author:** ![Arda\_Yurdakul](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/arda_yurdakul/32/2334_2.png) [@Arda\_Yurdakul](https://community.forestadmin.com/u/Arda_Yurdakul)\
**Post date:** [June 19, 2023, 9:45am UTC](https://community.forestadmin.com/t/smart-action-on-all-filtered-records/6410/5 "2023-06-19T09:45:00Z")

</div>

I have just now noticed that you can select all records, we thought you could only select the current page and did not see the tiny arrow mext to the checkbox. The UI for this is due for an update I would say 😆

Thank you for the help!
