Only allow a specified user to click URL Button

  • 0
  • 2
  • Question
  • Updated 2 years ago
  • Answered
I have a URL button for approval on a form. Above this I have a field where the user is picked. Is there a way to restrict access so that only the user specified can press this button? I have achieved this directly on the form using a form rule, but this button is also on reports that I would like to restrict the access as well. Additionally, if possible, can I restrict this button without making it hide from the form.

I have provided images. The button I am referring to is the "Employee Agrees" button. I would like only the user listed in the "Employee Name" field to be able to press this. I can achieve this through form rules, but the field still shows on any reports. I have this embedded on another table, so I need to be able to have this restriction there as well. 

Any help would be greatly appreciated!
Photo of Andreonna

Andreonna

  • 1,040 Points 1k badge 2x thumb

Posted 2 years ago

  • 0
  • 2
Photo of QuickBasePros_IDS

QuickBasePros_IDS, Champion

  • 2,266 Points 2k badge 2x thumb
You can set any field to View, Modify or None for each Role.  Access the field and scroll to the bottom of the field characteristics to set the Role Access Permissions by Role.  Set Roles you don't want to see the field to "None"
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
If your [Employee Name] field is a User field, then you can do it by making the formula cantain an if that evaluates the current user:

If([Employee Name]=User(), "My button formula for employee agrees goes here", "")

That will show the button for only the user in the employee agrees section, otherwise it will be blank.
Photo of Andreonna

Andreonna

  • 1,040 Points 1k badge 2x thumb
Sorry, I am really quite new at formulas in QuickBase. How would I add this additional IF function to my current formula? The formula currently in the button is:

var text url =
If([Employee Agrees Check]=false,
  URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
    "&rid=" & [Record ID#] &
    "&apptoken=cp2kg3vbugcf22bd656gmp4udhs" &
    "&_fid_9=true");

If([Employee Agrees Check]=false,
"<a class=\"Vibrant Primary\" href=\"javascript:" & "$.get('" & $url &
    "', function(){" & "location.reload();" & "});" &
    "void(0);\">Employee Agrees</a>"
)
Photo of Matthew Neil

Matthew Neil

  • 31,438 Points 20k badge 2x thumb
Put it before your second section.... with a slight change

If([Employee Name]=User() AND [Employee Agrees Check]=false,
"<a class=\"Vibrant Primary\" href=\"javascript:" & "$.get('" & $url &
    "', function(){" & "location.reload();" & "});" &
    "void(0);\">Employee Agrees</a>",
""
)
Photo of Andreonna

Andreonna

  • 1,040 Points 1k badge 2x thumb
Thank you! This appears to have worked perfectly!