Smart Action not displayed in the UI

Expected behavior

Any Smart action added to a collection in the forest/ folder should be visible for that collection in the Forest Admin UI when Actions button is clicked

I followed the smart action guides and did the following in the the following file:

forest/micro-topics.js

collection('microTopics', {
  actions: [{
    name: 'Mark as Live'
  }],
  fields: [],
  segments: [],
});

Actual behavior

The newly added Smart Action (added under the forest/***.js) is not getting listed in the pop-up that appears on clicking the “Actions” button.

But the same Smart Action is visible in the Layout Editor of the same collection.

Failure Logs

None

Context

Please provide any relevant information about your setup.

  • Package Version: 6.2.1
  • Express Version: 4.16.4
  • Sequelize Version: 5.15.2
  • Database Version: MySQL 5.7
  • Project Name: xs-library

Hi @Shriram_Balakrishnan,

Welcome to the ForestAdmin community and thank you for reaching out with your issue.

When adding a new smart action and in order for it to be available in your UI, you’ll need to restart your server. Have you done so?

I just took a look at what we have on our end, and it seems that only your product table have a registered
action.

Could you try to restart your server and reach out again if nothing shows up?

Hey @anon37102731

It was because of a code change. I have reverted my code changes. Now both the products and microTopics collections have that Mark as Live action.

I just figured that the Mark as Live action is available only inside a specific resource. That is, if I click on one of the “Micro Topic”, go to the next page and then when I click on the Actions popup, it is visible.

What I need is a custom action in the “Micro Topics” list page that will allow me to create microTopic in a customized way. That is, I need to add multiple virtual fields (fields not present in the microtopics model) to the form and get the data and store it across multiple tables.

I might have misunderstood your issue but what you seem to need is to define a global smart action that will perform your custom create, isn’t it?

Yeah, that works. Thanks!