Sometimes CRUD is just not enough...Resetting a password, blacklisting a user, and refunding an order – these are examples of your team’s integral day-to-day operations, that can be automated with Jet Admin.
A Flex Action is a custom button inside Jet’s interface that allows you to realize your own business logic through an API request to your servers.
To run operations on your records or implement any custom business logic on the backend, you would have to create Flex Actions and run them directly from the Jet Admin interface.
Passing additional parameters to your backend is supported.
It will first ask your backend for a list of available actions and then will execute them when you need to. Actions that are connected to specific collections will automatically appear in the Jet Admin interface. Then, you would have to define your Flex Action:
Define the list of available actions and their parameters
Execute a particular action
You can implement a Flex Action using one of the following methods:
After you have implemented this API method you should specify the Messages URL field in your Jet Admin Project Settings to finish the integration.
Go to Project Settings -> Flex Actions
If you've done everything correctly and saved all the changes, the actions you've implemented will appear in the Actions list ready-for-execute.
Once you've implemented all custom actions on your backend and specified Message URL, you can run these actions to check that they've been implemented correctly. First, select an action from the list of all available actions.
Specify required parameters. If its a Record action, then you should also specify the Record id.
You can check what Request headers (including Authorization header) and data will be sent to your API Method on action execution and what Response headers and data are received by Jet Admin. It will allow you to simulate real action requests and quickly test your actions.
model_action is an action that will be applied to selected users (for_instance==True flag)