Friends, today I solved a question I wanted to share with you. While I have asked the AppSheet team to create an "event" type action that can be triggered via a main button in any type of view, until that is heard (and voted on), we have to rely on an alternative solution.
This solution has already been addressed by many people, but I haven't seen it in this section, so I decided to share it here in case anyone is interested.
I must acknowledge that this solution comes from our dear friend @Steve
The idea is as follows:
The plan is to add an action button to a table, but row-level buttons are not available as primary buttons in table views—they only appear in detail views. Well, one of the solutions (the one I adopted) is to create an auxiliary table, which you could call SYS_ACTION, allowing add, delete, and update operations, with the following fields:
Then, create a form view or use the system-generated one—it doesn’t matter. Configure the view so that only [action_confirm] is visible and set it as the label because if you hide the id, the system will require a visible label.
Now, create an action to return to the view where the button is located, for example, using LINKTOVIEW(). In the "Event Action" section of the table view, select the newly created action so that when the form is saved, it redirects users back to the view they were in.
Next, create an action for the table where you want to add the primary button and set it as follows:
IF(
NOT(
IN(
USEREMAIL(),
SYS_ACTION[userid]
)
),
LINKTOFORM("SYS_ACTION_Form", "userid", USEREMAIL()),
LINKTOROW(USEREMAIL(), "SYS_ACTION_Form")
)
This ensures that if the email doesn’t exist, a record is created for the first time. If the email already exists, the record is edited instead. Keep in mind that we set "reset on edit" for the [action_confirm] field, meaning it will reset every time the form is opened and will be required.
Additionally, you can enable "auto save" so that when an option is selected, the form is automatically saved.
Finally, you can create BOTs to trigger actions when changes occur in the SYS_ACTION table.
The trigger could be [created_at] thinking that when the [created_at] column changes in the selected row, the associated events are triggered.
Please remember to create Backups of your tables before testing BOTs
I hope this tip, which worked for me, is helpful for you as well. You know I appreciate you all very much and value your support.