You are viewing limited content. For full access, please sign in.

Question

Question

Can you set a field's default value to the logged in user's role

asked on June 21, 2018

I want to create a section to hide on a form based on a user's role, but didn't see the user's role as a variable to select when trying to set the default value on a filed.  I am trying to prevent hard coding users names into the rules on the show/hide field rule.

0 0

Replies

replied on June 21, 2018

You would have to try and do this with custom js. I've added this feature request to our list. 

0 0
replied on June 27, 2018

There is a view on the Forms SQL database called TeamMembers. doing a field look up rule to this table/view can provide you with people's team membership assignments.

0 0
replied on June 30, 2018

So looking at the tables it looks like I can get to a specific team, but can't seem to find the correct combination of table and relationship to get to the role.  I am trying to filter a show/hide rule based on role.

replied on June 30, 2018

It looks like in the team member table there is a member_rights field that I can use.  It is associated with the Security Roles, and not the named roles you can make.  This will probably work for this particular case I have, but it would still be nice to be able to pull in the names roles of a team as a variable.

 

I found the table that has the named roles, but could not get it to query properly when I tried to connect different tables with relationships.  I couldn't get all the users defined.  

0 0
replied on July 2, 2018

I just created a new view on the Team Table and that should provide you with the needed team roles (of named roles)by user. see code attached.

SELECT     dbo.cf_users.username, dbo.cf_users.displayname, dbo.team_members.leave_date, dbo.team_members.member_rights, dbo.team_roles.name
FROM         dbo.cf_users INNER JOIN
                      dbo.team_members ON dbo.cf_users.user_id = dbo.team_members.user_id INNER JOIN
                      dbo.team_member_team_role_mapping ON dbo.team_members.id = dbo.team_member_team_role_mapping.team_member_id INNER JOIN
                      dbo.team_roles ON dbo.team_member_team_role_mapping.team_role_id = dbo.team_roles.id
WHERE     (dbo.team_members.leave_date IS NULL)

 

0 0
replied on July 2, 2018

Thank you, I will give this a try later....

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.