Forum Discussion

AvinashHiremat2's avatar
AvinashHiremat2
Qrew Trainee
7 years ago

Permissions - field access based on the value of field in a record

I have activities form in my app, one of the field is company id in that form. A company will have many users. I want to hide specific fields in a form based on the logged in user belongs to the company or not. How i could achieve this?

7 Replies

  • Make sure the company users are all in a user field. I would use a List-User field where you can add up to 20 users. Add that field to your form rule and state When "List-User" field includes "Current User", show fields.
    • AvinashHiremat2's avatar
      AvinashHiremat2
      Qrew Trainee
      Thank you for your reply. But i do have more than 20 users belongs to a company, any alternative solution?
    • GilbertSpigelm2's avatar
      GilbertSpigelm2
      Qrew Cadet
      You need to find a way to group these individuals. Can you group company employees within a specific role and then use the role in a rule? Or create more than List-User field and have a rule stating if they exist in this field or the other field, then show fields. 
  • Hi Gil,

    This is certainly achievable (if I'm understanding correctly) but the setup is a bit tricky...especially if you have a lot of tables and/or a deep hierarchy. I mocked up a basic example below. Keep in mind this is security by obscurity, since form rules are NOT database permissions; and QB doesn't currently support field level (conditional) user permissions.

    The basic idea is to write a formula in your table that contains users; that resolves to the value of 1 if it's the current user's record and 0 if its not. THEN you can summarize that value up to your companies table, and pass it over to any child tables as a lookup. THEN you can use this field to control hide/show form rules.

    I hope that makes sense!

    Charlie

    • GilbertSpigelm2's avatar
      GilbertSpigelm2
      Qrew Cadet
      Hi Charlie,

      Although this wasn't my topic, I like your idea. I was wondering how to use a User table to make this work. 

      Avinash, Charlie's idea would work for you.
    • CharlieMurawski's avatar
      CharlieMurawski
      Qrew Cadet
      ahhhhh my bad...yes my comment was directed at Avinash!

      Thanks Gil :)