I have a deck view listing available jobs to start. Selecting a row, triggers an action to start a job. However, this should only be allowed for users with a specific role. I have a user table where user is linked by an email address and user roles. Only users with roles “Technician” or “Team Leaders” should be able to run this action.
I’m attaching some screen prints of the views and the action. the technician ID is inserted correctly, but I’m not sure where to limit the action to be run. Any help will be greatly appreciated.
I have created a slice, called “Current User” on the user table, that filters: USEREMAIL() = “Email Address” (“Email Address” being the email column in the User Table)
Then added the following in the Action as per your suggestion:
If you want something else to happen when other users select the row, then create a group action that includes the Job Start action that you already have as well as the action you want to occur for other users. In the action for other users, define the Only if this condition is True property using an expression that enables the action for those other users. Then, in the view’s select row event, associate the group action.
Actually, if a user doesn’t have role of “Admin”, “Team Leader” or “Technician”, doing nothing is perfect. But when the user has one of those roles, the action should execute.
Sorry–I misread your other reply that I responded to.
If you didn’t already, confirm the action is explicitly added to the slice. It shouldn’t be possible to set a view’s event action to an action not added to the slice, but maybe that validation isn’t in place?
thanks @dbaum It wasn’t explicitly set. It is now, but still, when I select the row, nothing happens, no matter what role the current user is. I’m assuming explicitly set means this (please see screen print)?
It really feels like this should be working. I’m probably missing something somewhere.
By “explicitly”, I just meant that it’s included in the Slice Actions, whether directly selected on its own, as in your screenshot, or within the “all actions” selection.
I don’t know why it’s not working for you.
Are you successfully using elsewhere in your app the following expression based on a “Current User” slice that you shared in a previous reply?
@dbaum , I haven’t used it anywhere else yet. But I just did a show_if on a view, and it is also not displaying for the specified role, so I’m guessing there is something wrong with the way I call the user role. I’m just not sure why. Guess I’ll keep looking. Thanks for your help anyway.