Only certain users should have access to run an action

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.

Selecting the rowSelecting the row

 

The action "Job Start"The action "Job Start" 

Solved Solved
0 11 716
1 ACCEPTED SOLUTION

@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.

View solution in original post

11 REPLIES 11

create an action that will do something depending on the user's role.... 

So you need to update the "Only if this condition is True" formula to include:

AND(

  [Status]<>"In Progress",

<formula to identifty "Technician" or "Team Leaders">

)

Simon@1minManager.com

Thanks @1minManager 

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:

AND(

[Status] <> "In Progress",

IN(INDEX(Current User[Role], 1), LIST("Admin", "Team Leader", "Technician"))

)

Where "Role" is another column in the User table, containing values of either Admin, Team Leader, or Technician.

But with this in place, selecting the row just does absolutely nothing. No matter whichever User.

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.

the same as what I said. only in more detail.๐Ÿ‘

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. 

I would have thought the line

IN(INDEX(Current User[Role], 1), LIST("Admin", "Team Leader", "Technician"))

should work fine, but for some reason, nothing happens.

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.

Screenshot 2022-08-05 at 11.20.02.png

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?

INDEX(Current User[Role], 1)

@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.

Fount it. It was my mistake๐Ÿ™„

My Current User Slice was: USEREMAIL() = "Email Address" instead of 

USEREMAIL() = [Email Address]

Top Labels in this Space