How to reference a session customProp in a gatewayEvents script context

Hi folks.

I’ve implemented a script like scripting function (perspective 8.1.18) that run in a gateway Event context, so I do this call in the event tab MyScriptingFile.myfunc().
In my script, I need to access to a specific sessionCustomProp but for the gateway context if I type
something like self.session.custom.obj_myComponentSettings I have an error (and it’s correct
for the gateway context).

I actually pass this reference like a parameter assigned before calling the script func.

My question is: how (if is it possible) can I insert the reference of this sessionCustomProp inside my scripting function?
I suppose something like:
.session.custom.obj_myComponentSettings

THX in advance, C.

You cannot.

Even if you could, which user’s session would you need?

You can send a message with system.util.sendMessage to scope S and let a session message handler do the work.

1 Like

Hi.

Sorry, but I can’t understand why I need to consider the user of the session?

In any case, this is a good solution but I’d like to remove the assign operation before
the calling of scripting func and put it inside a scripting function to not have always to remember
myself to do it before the func call.

Maybe something like [system.util.getSessionInfo] return the reference of the session?

Gateway events don’t have a session. If no client is connected, there’s no session at all.

If what you are trying to do is specific to a session, and the project library function is always going to be called from a session/page/view/component event, then pass the session as a function parameter. Or pass the page/view/component (self) if that is more useful.

Project library scripts don’t have a scope of their own. You must pass scope-related variables to them. As function arguments, typically.

Thanks for the clarification P., I actually pass variables to my script as function arguments to turn around
of the scope limits.

C.