Smart segment to restrict access to an action on a record details view
Please be sure of your agent type and version and pick the right documentation accordingly.
This is the documentation of the forest-express-sequelize
and forest-express-mongoose
Node.js agents that will soon reach end-of-support.
forest-express-sequelize
v9 and forest-express-mongoose
v9 are replaced by @forestadmin/agent
v1.
Please check your agent type and version and read on or switch to the right documentation.
Smart segment to restrict access to an action on a record details view
Context: As a user, I want to enable or not a smart action for a record depending on the value of a smart field.
In this example, the user wants to enable the access to a smart action called restricted action
for a collection customers
solely for customers that have registered orders
. In our data models a customer hasMany orders.
The behavior observed above corresponds to this implementation in the file customers.js
This works only at the level of a records details view as we are looking to catch the query made to ensure that the action should be visible. This query is structured this way and allows us to implement the logic above by retrieving the record id present in the filter:
Last updated