Setting session custom variables with a gateway startup script

I have a perspective project that I want to set some of the custom variables on startup so that I don’t have to make sure that I clear them after each design session. I can’t figure out how to target those variables from a startup script though. I was trying self.session.custom.foo with no luck.

Anyone else know how to do this? Or is there a setting somewhere that sets all session custom variables to null at startup. That would work for me as well.

Are you trying to use a gateway startup script, or a session startup script? You should be able to modify your session props from a session startup script just fine; just access the session parameter:
https://docs.inductiveautomation.com/display/DOC80/Perspective+Session+Event+Scripts#PerspectiveSessionEventScripts-Startup/ShutdownEventScripts

I was trying to use gateway startup events. I had forgotten about the session events.

1 Like