Loosing Session Variables

Loosing Session Variables

  
hi everyone

i created a session variable which is set within the login logic,
but it seems to only be set in the module where the user logs in.
when i navigate to a different module and want to use the session variable there, its empty...

from what i checked in the other posts, i can say that:
all modules are using the same user provider
and i tried with HTTP security set to empty/none and SSL in the according flows

also when the security is set to SSL; and i click on myinfo (top-right) it changes from HTTPS to HTTP
eventhough both have SSL set

has anyone got an idea, how i can get the session variable properly transfered from module to module?
and maybe a clue about the HTTPS switching to HTTP?

thank you!
That is exactly how session variables work. They are not shared between eSpaces, and you cannot make them "public" to be referred to by another eSpace.

If you really need to share them, create an Action in the other eSpace that accepts the value and sets an identical Session variable in that eSpace, and make the Action public. If you want changes to go back to the original eSpace's session, do it the other way too.

In general, session variables are almost always the wrong way to do things. I bet that if you really look at your needs, there is a better way of doing these things than a session variable.

J.Ja
how does it work with the userid session variable then?
what im trying to store is the active contact reference,
since the users can have diferent contact details,
which they might want to change within one login session
UserId is a special exception, because it is set by the system.

I don't know the details of your project, so I can't really help you based on the short description that you've given. Could you provide a more complete explanation of what you are trying to do?

J.Ja
well as mentioned, a user can have multiple contacts, ie. private and business
and he/she can switch between these two, without having to relogin or similar

this contact reference is used throughout all modules, to identify multiple things;
who to contact, screen behaviour, deeper privileges etc,
which would make it sensible storing the active reference, in a place like the session.
also to prevent a further db-query on every change of module
Well in that case what you can do.. is create an API from that espace.. meaning.. create an optimal number of function.. to set or get that session variable from that espace.. 

if this makes you to have to cycle trough a session record list.. you might consider creating a table and there for a record to accommodate your needs.. and at the end to the session delete the record or keep it for a persistent state.

Keep in mind that the Outsystems platform uses this technique itself.. from my point of view.. its perfectly normal..  
Hi,

How are you accessing the session variable? By your description it looks like you just added a Session Variable in all your modules with the same name and expected it to work.

Like Justin said in the first post, you need to define it on one eSpace and then access/set it using a public action of that eSpace.


As for the jump from https -> http, it only supossed to happen if you are in a screen with HTTP Security: SSL and jump to a screen with HTTP Security: None
Note that when nothing is written on the HTTP Security property, it is inherited from the parent flow.

Regards,
João Rosado
aaah ok! makes perfect sense now
probably my thinking was still in the ABAP world =)

thank you guys!
João Rosado wrote:
As for the jump from https -> http, it only supossed to happen if you are in a screen with HTTP Security: SSL and jump to a screen with HTTP Security: None
Note that when nothing is written on the HTTP Security property, it is inherited from the parent flow.
 
that is the case, for additional certainness i also set SSL everywhere
could it be, because were linking from one espace to another?
Te previous posters have it right, either call a function in each module to set it in their session, or have them call a function as needed to get the value from where it is set.

J.Ja