I want to execute a script when a user login the perspective session.
And the script will execute based on his ID.
I tried to execute the script when the following tag value change:
def valueChanged(self, previousValue, currentValue, origin, missedEvents):
user_id = currentValue
But I cannot get the printout each time a new user logged in.
How can I get this function working?
I suppose you could you could use the on startup session event and check the
session.props.auth properties to build your logic.
What's the end goal ?
Yes, maybe check the userID at Mainview.
When a new user login, I need to execute a script to assign properties to this new user.
I will have a try of the startup event.
That's not an end goal, that's the means to the end.
Your script seems to be in the correct place, but I think your expectations are incorrect; that function prints the supplied string to the browser console of the open session. I think you're looking for something more like this:
I still cannot get the value change of this property to work.
But I mapped this tag to a custom tag, then it works to trigger action on the value change.