What is the syntax to write to a perspective session custom property?

I have a session custom property called WorkstationName. I want to perform a database query to lookup the WorkstationName and then write that value to the custom property.


In the Startup Session Events I have the following code:

def onStartup(session):
    #self.session.custom.WorkstationName = 'blue'
    session.custom.WorkstationName = 'blue'

I have been messing around with different options and while nothing seems to break it also doesn't want to set the custom property either.

Any idea about what syntax to use?

That looks OK to me. How are you proving that it doesn't work? Have you checked in the client?

In the attached picture I have a label on a view bound to the session property.

And you check its value in a client, not just in the designer?

Yes sir.

That event only fires when a session first starts. Depending on your settings, a session may persist long after you close or refresh the browser client page. The easiest thing to do is to terminate the session from the web status portal under Perspective Sessions and then relaunch a session/client

I see now. After termininating the browser session from the gateway web page the following code executed correctly.

session.custom.WorkstationName = 'red'

Thank you for the help.

1 Like