sessionScope not working in Client but works on web

I’m new to Xpages and for the life of me can’t figure out what I’m doing wrong here.

I am setting a sessionScope variable in the beforePageLoad event of an xpage and then trying to retrieve its value in some SSJS. On a web browser it all works perfectly, but on a Notes Client I get “undefined” for my value.

Anybody have any advice for me?

Thanks,

Dan

Subject: sessionScope and beforePageLoad

I’m not aware of any problems wih setting sessionScope variables in beforePageLoad. I tried setting a scoped variable in beforePageLoad and I can see it set. What is your code?

If you don’t already use it, I recommend following Declan Lynch’s suggestion for a debug panel Advanced XPages : Debugging Scoped Variables | Dec's Dom Blog. I use it in all applications, showing if I’ve set a sessionScope variable called showDebug to true.

Subject: code

Thanks for the suggestion with the debug panel. I’ll look into that. The code for setting the sessionScope is as follows:

xp:this.beforePageLoad<![CDATA[#{javascript:if(@ClientType()==“Notes”){

 sessionScope.protocol='"Notes://';

}else{

 sessionScope.protocol="http://"; 

}

 }]]>

</xp:this.beforePageLoad>

Thanks for the help.

Dan

Subject: Re: Code

The code looks okay, but I notice that your protocol variable for Notes is set to ‘"Notes//’, i.e. you have a double quote inside the single quotes. Is that the problem?

It certainly seems to be identifying Notes and web okay on 8.5.1.

Once you’ve got it working, you might want to look at how the XPages wiki sets such session-based variables through a function in a script library, so it’s only set once per session. Though I ppreciate that’s a luxury at the moment.

Subject: Strange, it’s working now…

For some reason, it’s working today. Who knows why… And yes, you are right about that typo of extra quotes. Thanks for pointing that out. It was actually working even with that, so go figure.

Thanks for the help.

Dan

Subject: environment

i think that in the client environment session variables does not exist. Since the 4.x notes releases need to use @environment to simulate session variables in client.

there are new features with domino 8.5.1 about the client session variables ?