ChrisG
ChrisG

Reputation: 1346

UserProperties being shared between users in Google Apps Script published UI service

I am working on a google apps script that is being published as a service, and accessed by multiple users via the UI.

The problem I'm having is that when one user causes a UserProperty to be set, all the users subsequently have their UserProperty set to that also. In other words it is acting like a ScriptProperty, rather than a UserProperty, in that it is not User specific. All users appear to cause this to happen.

I have studies my code and I just cannot see that it is anything to do with that. I make no reference to EffectiveUser, so only ActiveUser could ever be setting these values.

My guesses are: - I am misunderstanding the scope of UserProperties - My variables have somehow become corrupted (I have had problems with other UserProperties variables doing some odd stuff)

Has anyone experienced this, or does anyone have any suggestions?

Regards Chris

Upvotes: 2

Views: 1007

Answers (1)

Srik
Srik

Reputation: 7957

UserProperties are better suited for scripts that run inside Spreadsheets and not published ones. The reason is that a published script runs under the user id of the user who created the script and not as the person who invokes it.

So, if the script is written by [email protected], then the UserProperty will be that of [email protected] irrespective of who invokes the script. So, when one user writes a UserProperty, all others see the same value

Upvotes: 5

Related Questions