OK, here's the setup.
Create a table of Users where the K
ey field is userid. Let's call the table
Users Limited By Company.Create relationship where One Company has many Users. Great, now each userid knows the Company they need to be limited to.
Here is the magic.
Create a relationship where 1 Userid in that table has Many "records". If there are multiple tables which need to be limited you will need to do this for each table. Let's say the table being Limited is "Orders". OK so One User has many Orders. Change the reference field on the right side of the relationship from being called Related User to be called [Current User] . Of course you know that just calling a field [Current User] don't make it actually be [Current User] so we change this to a formula user field with the formula of
User()
That function returns the current user.
That's the very kernel of the magic that only Quick Base can do. So now look up Company from that relationship down to Orders, ie that will be the Company for the hands on keyboard current user,.
Make a formula checkbox field called [User allowed to see this company?]
IF([Company] = [Current User Company], true)
Now set up just 1 Role for regular users limited by company and set the Custom rules to only be able to see Orders where [User allowed to see this company?] is checked.
If you need a higher level Role with Share permissions, then go ahead and duplicate that Role but use the same type of Customer Rule to limit access. Note also that if you need that field on any child records of orders, say Order Line, you can just look up that fiel form the parent and make a similar Customer Permission Rule
Voila, one role (except you need two due to different Share permissions.
------------------------------
Mark Shnier (YQC)
Quick Base Solution Provider
Your Quick Base Coach
http://QuickBaseCoach.commarkshnier2@gmail.com------------------------------
Original Message:
Sent: 11-26-2019 10:48
From: Don Larson
Subject: Create a Role using QB API's
Sterling,
Please follow up with Mark. You do NOT want those Roles!
His solution will be much more elegant and easier for you to maintain.
------------------------------
Don Larson
Paasporter
Westlake OH
Original Message:
Sent: 11-25-2019 22:15
From: Sterling Long
Subject: Create a Role using QB API's
Hey guys!
I am trying to create a role automatically whenever a new record is added to a table.
Sadly, and for some reason, this is the only thing that the QB APIs doesn't have access to.
Does anyone know of a way to do this? Or will I have to manually create the roles for each record?
Any responses are welcome, thank you!
------------------------------
- Sterling Long!
------------------------------