How can I create a custom rule for a roll using the "or" qualifier instead of "and"?

  • 0
  • 1
  • Question
  • Updated 3 years ago
  • Answered

I am creating an app to handle employee vacation.  Right now I have 2 roles:  Employee and Manager.  I also have two tables: Employee and Manager.  Everyone is an Employee and that is where you track your personal vacation days.  When you click on a Manager, you can see all of their direct employees and they collected vacation schedules.

When you log in as an employee you only see your vacation information.  That is easy.  When you log in as a manager, you need to see your personal information and the information of all of your direct reports.  Because the custom rule is an "And function", I can't set it up so that you can see things when the "Manager User" equals current user and when "Employee user" equals current user because that returns 0 results since no one is their own manager.  I can make it to just look at people for whom you are the manager, but then you can't see yourself.  I can also set it so there is a formula field that returns a certain value if the employee is managed by you or is you, but then the manager's manager won't be able to see that record.  Because our org chart is stacked several people deep, I don't want to have to create a new table for each level in the company to look down.

Any ideas?

Photo of David

David

  • 294 Points 250 badge 2x thumb

Posted 3 years ago

  • 0
  • 1
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 4,208 Points 4k badge 2x thumb
This is a common problem for which you must build a formula field to determine your output.  Then you write a rule based on the formula.  You will need the field to be displayed in the form (even if it's in a hidden section); so that the form can reference the formula in the form to action your rule.

Formula would likely be:

If(User()=[Manager User] or User()=[Employee User],true,false)

Another way to write it is:

If(User()=[Manager User] or User()=[Employee User],User(),null)

This second option can be better if you want to then make form rules looking for the User=User in Field.

You should consider moving this "permission" to the Role so that the User assigned to the role can see any record where the checkbox =true or where the formula field = Current User.