# Get\_ids\_from\_request helper does not work for bulk smart actions on related data

**URL:** <https://community.forestadmin.com/t/get-ids-from-request-helper-does-not-work-for-bulk-smart-actions-on-related-data/7590>\
**Category:** Help me!\
**Created:** [November 2, 2024, 3:36pm UTC](https://community.forestadmin.com/t/get-ids-from-request-helper-does-not-work-for-bulk-smart-actions-on-related-data/7590 "2024-11-02T15:36:31Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbescoyez](https://dub1.discourse-cdn.com/flex013/user_avatar/community.forestadmin.com/jbescoyez/32/7444_2.png) [@jbescoyez](https://community.forestadmin.com/u/jbescoyez)\
**Post date:** [November 2, 2024, 3:36pm UTC](https://community.forestadmin.com/t/get-ids-from-request-helper-does-not-work-for-bulk-smart-actions-on-related-data/7590/1 "2024-11-02T15:36:31Z")

</div>

## Feature(s) impacted

Smart action on related data

## Observed behavior

When using `ForestLiana::ResourcesGetter.get_ids_from_request(params, forest_user)` ([like explained in the documentation](https://docs.forestadmin.com/documentation/reference-guide/actions/create-and-manage-smart-actions/use-a-smart-action-form#get-selected-records-with-bulk-action)) in smart actions, it would throw an error if:

- the smart action is executed from related data in a collection
- the smart action is executed on all documents

E.g:

```javascript
def my_custom_action
  ids = ForestLiana::ResourcesGetter.get_ids_from_request(params, forest_user)
  => eval error: undefined method `to_sym' for nil
  /gems/ruby/3.3.0/gems/forest_liana-9.4.1/app/services/forest_liana/has_many_getter.rb:69:in `model_association'
  /gems/ruby/3.3.0/gems/forest_liana-9.4.1/app/services/forest_liana/has_many_getter.rb:11:in `initialize'
  /gems/ruby/3.3.0/gems/forest_liana-9.4.1/app/services/forest_liana/resources_getter.rb:156:in `new'
  /gems/ruby/3.3.0/gems/forest_liana-9.4.1/app/services/forest_liana/resources_getter.rb:156:in `initialize_resources_getter'
  /gems/ruby/3.3.0/gems/forest_liana-9.4.1/app/services/forest_liana/resources_getter.rb:26:in `get_ids_from_request'
  (rdbg)//usr/src/app/app/controllers/forest/financial_transaction_actions_controller.rb:1:in `match_without_document'
end

```

For now, I have managed to mitigate this behavior with the following (ugly) workaround:

```javascript
def my_custom_action
    attributes = params.dig(:data, :attributes)
    attributes[:association_name] = attributes[:parent_association_name] = "financial_transactions"
    attributes[:id] = attributes[:parent_collection_id]

    ids = ForestLiana::ResourcesGetter.get_ids_from_request(params, forest_user)

    # ...
  end

```

!!! Note: this workaround does not work on smart relationships.

## Expected behavior

The helper would return the list of impacted ids.

## Context

- Project name: Finance X
- Team name: Operations
- Environment name: Development
- Agent technology: rails
- Agent (forest package) name & version: forest\_liana (9.3.16)
- Database type: postgresql

---

<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:** [November 4, 2024, 1:07pm UTC](https://community.forestadmin.com/t/get-ids-from-request-helper-does-not-work-for-bulk-smart-actions-on-related-data/7590/2 "2024-11-04T13:07:49Z")

</div>

Hi @jbescoyez and thank you for your bug report 🙏

Our tech team is actually working on a fix. We will let you know once the fix is live

---

<div class="post-metadata">

**Author:** ![anon21153075](https://avatars.discourse-cdn.com/v4/letter/a/4af34b/32.png) [@anon21153075](https://community.forestadmin.com/u/anon21153075)\
**Post date:** [November 4, 2024, 1:30pm UTC](https://community.forestadmin.com/t/get-ids-from-request-helper-does-not-work-for-bulk-smart-actions-on-related-data/7590/4 "2024-11-04T13:30:39Z")

</div>

Hello, The fix has been released on the new version 9.4.3
