Readable If within a range
Hello,
I want to display only specific records if a user has access to them.
I have a table named UserX where Employee is a user field and 'Account Access' which is a Dynamic Multi Choice. I use this table to select the specific user and select multiple Accounts they will have access to.
In the Accounts table in Readable If parameter, I am trying to set the formula to look up the current user in UserX and check if they have read access to the record/account via 'Account Access' field but I cannot get this to work.
This is what I have so far (and it's not working):
let currentUser := user();
let sel := first(select UserX where Employee = currentUser);
Id like [record(UserX,sel).'Account Access']
Any suggestions?
3 replies
-
To get the record ids of a Dynamic Multiple Choice field you need to use the numbers() function. This returns an array of the ids. There isn't a function which can find an element of an array so, in your case, I have chosen to loop through them. So the script you need to use is
let a := this; let b := false; for c in select UserX where Employee = user() do for d in numbers(c.'Account Access') do if d = a then b := true end end end; b
Regards John
-
S Moore I have just realised that this doesn't allow someone to automatically have access to all the accounts. A subtle change to the code could allow that. Use isAdminMode() to set b at the start and that way setting the wrench to red would give full access.
let a := this; let b := isAdminMode(); for c in select UserX where Employee = user() do for d in numbers(c.'Account Access') do if d = a then b := true end end end; b
It doesn't work 'on the fly' if you are already in Accounts, but re-sets itself by moving away from that table and coming back again.
Regards John
Content aside
- 2 yrs agoLast active
- 3Replies
- 119Views
-
2
Following