Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

How to read session var in CustomStore in ClientContext

Avatar

Level 3

Hi,

I have created customStore in Client Context. :

   CQ_Analytics.CustomStoreMgr = CQ_Analytics.JSONStore.registerNewInstance("customstore");

I am able to read the request param as well as something from SlingService call and populate in Client Context as one attribute.

 

But now I wanted to read browser session attribute in this custom store. As this information is already available at client side I dont want to make slingService call or wanted to pass as URL parameter. 

As we have request object in client store I tried using request.getSession but no hope. 

 

I tried '<%=session.getAttribute("abc")%>' in JS but this also not working in customStore JS. (this works in JS which is on any component JSP page)

 

Can any one please guide how to read Session in customStore ?

3 Replies

Avatar

Level 3

No one knows how to read browser session attribute in Client context :( 

Avatar

Level 6

I think if you define a javascript variable in the page with the session value, you will be able to use it on the client context.