I wanted to have a "admin" mode in on of my apps where specific user would be able to set parameters valid to everyone else. I tried doing this using temporary state variables, but for this I would have to be able to programmatically set the initial value of a state, but this doesnt seem to be possible.
Is it possible? Or do you suggest any different approach?
Is it that you want to change the initial value based on another user and then when the admin clicks a button, the temp value is changed? Sorry but I am only aware of .setValue on the temp state and not the initial state....
That's the point of setting a temporary state value in what I wrote above.
The initial value would not have to be changed if you simply use the .setValue method for each user to set programmatically and take that value while the initial value can remain the same and would not be looked at by any user and only used by your application.
To give a specific user group, you can use the advanced tab here and set it to group level access depending, I think, on what version of Retool you have...
@igoraguiar You should be able to use a JS query to set the state of one of the global variables in the app you are in, but I am not sure if this will take affect for other uses in that specific app. Another way you could do this is to introduce a page before the one you want to influence for all users and in that page create a link that automatically sets URL parameters to the app URL so that the page has a context set on it each time someone visits the page.
Ultimately not ideal for what I think you want your UX to be, but an option that is not a database
You may also be able to set the default URL parameters for a page, but that might have to be manually managed rather than through a button like you are suggesting....
For instance, I have an App I wrote for my sellers that takes in an API token so that that App always syncs with my seller's personal sandbox. This is context that is User specific obviously and not global, but in the past I have just hardcoded a variable into the app since I'm the admin editor and it universally applies to whomever is using the app