# Smart Action availability on condition

**URL:** <https://community.forestadmin.com/t/smart-action-availability-on-condition/6856>\
**Category:** Help me!\
**Created:** [November 21, 2023, 4:54pm UTC](https://community.forestadmin.com/t/smart-action-availability-on-condition/6856 "2023-11-21T16:54:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dscreve](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dscreve](https://community.forestadmin.com/u/dscreve)\
**Post date:** [November 21, 2023, 4:54pm UTC](https://community.forestadmin.com/t/smart-action-availability-on-condition/6856/1 "2023-11-21T16:54:10Z")

</div>

Hello,

I would like to have a smart action only on some records on my collection, depending on record content.  
I did not found how to do that.

I know how to customise smart action according to record content, but I want to make action availability conditioned by record content.

Could you help me ?

David

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [November 22, 2023, 8:04am UTC](https://community.forestadmin.com/t/smart-action-availability-on-condition/6856/2 "2023-11-22T08:04:40Z")

</div>

Hello @dscreve,

Thanks for reaching out 🙌

The solution here is to create a [segment](https://docs.forestadmin.com/user-guide/collections/segments) that match the records that are eligible for that smart action.  
Then, you can [restrict this smart action to this segment](https://docs.forestadmin.com/user-guide/collections/actions/create-and-manage-smart-actions#enable-disable-a-smart-action-according-to-the-state-of-a-record).The smart action then will be available only through that segment list or directly on the given records (if they match the segment condition).

Does it help?  
Let me know!

Cheers.

---

<div class="post-metadata">

**Author:** ![dscreve](https://avatars.discourse-cdn.com/v4/letter/d/5e9695/32.png) [@dscreve](https://community.forestadmin.com/u/dscreve)\
**Post date:** [November 24, 2023, 10:42pm UTC](https://community.forestadmin.com/t/smart-action-availability-on-condition/6856/4 "2023-11-24T22:42:49Z")

</div>

Hello,

This does not helps me because I want to do this by code while adding the action to collection.

Regards,

David

---

<div class="post-metadata">

**Author:** ![anon34731316](https://avatars.discourse-cdn.com/v4/letter/a/eada6e/32.png) [@anon34731316](https://community.forestadmin.com/u/anon34731316)\
**Post date:** [November 27, 2023, 9:51am UTC](https://community.forestadmin.com/t/smart-action-availability-on-condition/6856/5 "2023-11-27T09:51:16Z")

</div>

Hello @dscreve,

You can choose to treat the records differently in your smart action code (and either send a success or an error message for instance).  
However, for the UI action availability, it can be only done the way I told you.

Cheers.
