Context
This is the official documentation of Forest Admin Cloud.
The context
of an action contains all the context data when the action is executed in Forest Admin.
Getting the selected record(s)
To get the selected record(s) on which the action is executed, use the getRecord()
or getRecords()
methods from the context.
Example:
execute: async (context) => {
const { id, email } = await context.getRecord(['id', 'email']);
},
Getting the selected record id(s)
Additionally, you can retrieve just the id(s) by using getRecordId()
or getRecordIds()
Example:
execute: async (context) => {
const id = await context.getRecordId();
},
Getting the collection
To access the collection associated with an action, use the collection
attribute. To see the capabilities of what collection
provides, please see the following section: Query interface and Native Queries
Example:
execute: async (context) => {
await context.collection.update(context.filter, { isBanned: true });
},
Last updated
Was this helpful?