Hi
I feel like I really should know the answer to this, but I can’t get it to work.
I need to allow users with the Admin role to be able to add users with a User role. I have set up a Roles column.
In the users table, Row owners is set on Email address.
Then I have two more columns with row owners set which I write in manually in each cell “Super Admin” and “Admin” so that I (with the role “Super Admin”) and the 2 x Admins can see all entries (Though Admins can’t see me). For ease these two columns are called Row owners/Super Admin and Row owners/Admin
Then in the front end, if you are logged in with the role “Admin” you can see all the users, then add a user as you like via a form screen. Then “On submit” action writes to the new row “User” in the Admin column, “Super Admin” in the “Super Admin” column and “Admin” in the “Admin” column.
Testing it from within the builder and viewing as one of the Admins - it works. But in real life, when the Admin adds a user, the “On submit” action doesn’t complete.
UPDATE - Testing via the builder works momentarily - but then the info is lost. So I must be approaching this the wrong way??
Should I be triggering a manual workflow instead of using On submit?
Andrew
For clarification, are you trying to update the role column or just the row owner columns? It’s not clear to me what your role column is named and if you are trying to change it.
Also note that you have your form set up to add a row that the admin does not own, and then you immediately try to update it on submit. As soon as you submit that form, it adds the row but you are not the owner, so technically there is no row to update. You are better off setting those values in the form before it’s submitted instead of afterwards in the on submit action.
If you are only updating row owner columns, then the above changes should work. If you are attempting to update a role column, then you will need the manual workflow.
Thanks loads Jeff (as always!)
I am updating the “Role” Column - which is my designated column for roles in User Profile.
It also makes sense why it is behaving this way.
So is your suggested best practice to use the Special Values within the Add form? That makes sense if so. I need to add “User” to the Role - so I guess I just add that to the user row too?
Thanks again - life saver!
It’s probably a two-fold issue here. Trying to update an unowned row after it’s created, and trying to update a Role. Roles cannot be changed client side for security reasons. You will need to use a manual workflow to change the Role server side. Row Owners can still be changed client side, but you should be using the special values within the form.
(I can’t confirm off the top of my head, but it was kind of understood that roles could be changed client side it the user setting the role had the same role that was being set. I don’t know if that was ever really true or is today, but using a server side workflow is generally safer.)
They can be set when a row is added (if the user has the role being set), but they cannot be changed.
Ah, ok. That was the catch.
Thanks both
Maybe I will just let people request access! Though if I do, how do I set a role?! Didn’t realise this would be such a pain!
It’s easy enough, you just need to use a server side workflow. Manual Trigger is the best. Pass the user email and role values as parameters, and go from there.
Thanks again
I assume this is correct for the workflow?
It’s not a great user experience, because it takes a few seconds to show up - so immediate thought it - is hasn’t worked!
Your help is much appreciated !
UPDATE - this seemed to occassionally fail for some reason. Looking at the history - the correct email address is passed. Pasting that into the test fields and running it completed successfuly - so maybe it take a moment for the new row to be added? (I am using Glide tables - not GBT)
Changing the query to return multiple - and then adding a loop has (so far) resolved it. Adding a 3 second wait before triggering the manual workflow didn’t work
Yes, except Item 1 should be an email type.
Doohhhh… of course - thanks