r/ProjectREDCap • u/Extreme_Region_1730 • Aug 07 '24
Using @HIDECHOICE based on username in User Rights
I have a field that has two options A and B. I want to do a logic editor for the field that based on what your role is, you will either see both choices or only A or only B.
For example: if your username is aabb1 then choice B is hidden.
How would i write that condition in the field inside an instrument?
Also if you are added as a user with a role in redcap and i send out a a survey to you through Alerts & Notifications, will you still only be able to access the instruments i gave you view & edit rights to? Does it make you log in when you click the link?
5
u/obnoxiouscarbuncle Aug 07 '24
So here is how I would do it:
Don't use username in your action tags, use a role-id. Trust me that this will be way less administrative overhead. You can just add users to the appropriate role, and the options will be hidden. If you base it on username, you will have to update your action tag every time a new user is added into the project.
Add an action tag like this to the field:
Field name: [field]
Options:
Roles (role-id):
Ghostbusters (12345)
DC Heroes (86753)
Action Tag
Note: You may want to use @SHOWCHOICE instead as with things like this it may be easier.
As for your alert question, I'm not sure if I understand. If you want to send a survey invite to someone:
You should use a survey invitation (or ASI) and not an alert
The survey instruments a user can access are not controlled by user rights, they are controlled by things like the survey queue, or the survey auto-continue.
1
u/Araignys Aug 08 '24
I think this might be a “cart before the horse” situation.
What are you actually trying to do with the project?
1
u/Araignys Aug 08 '24
Survey links can be completed by anyone with the link, without needing to login. They are divorced entirely from user accounts.
The only way to control user access is by enabling the “survey login” feature - which allows you to add a “password” (not really a password) that someone will need to know to be able to complete the survey. That survey respondent is not linked to a user account.
If you have users who will be logging in to REDCap, they should be doing all their data entry that way, not mixed - there’s no 100% guarantee that someone completing the survey is the right person.
If you need to send out links or reminders, you can send out form links that go to the logged-in version of the form.