Access to Session Attributes from WorkflowAccess to Session Attributes from Workflowhttps://liferay.dev/en/c/message_boards/find_thread?p_l_id=119785333&threadId=1186054632024-03-28T18:33:09Z2024-03-28T18:33:09ZRE: Access to Session Attributes from WorkflowDaniel Ghttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186083512020-02-27T15:58:14Z2020-02-27T15:58:14ZThanks for the answer.<br />I've had a list of sites that are shown in every navigation if an expando value matches a fixed value.This list is updated in a portlet which changes the value of this site expando, and it should be updated too with the portlet. A job inserts in database all the sites which have this expando value and the user which has a certain role in the site, and when the user is logged in, it is stored in session the list with the sites only for that user. <br />This is why I want to do it with a parameter session, because I can't imagine another way to do it. Database access in every navigation is not possible because it makes the portal too slow. The solution that I'm trying to implement is valid in terms of performance.<br />Regards.Daniel G2020-02-27T15:58:14ZRE: Access to Session Attributes from WorkflowOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186093012020-02-27T15:50:29Z2020-02-27T15:50:29ZThat's because workflow scripts are<em> not tied to a HttpRequest </em>- they can be triggered by API calls, e.g. timer based, when there's simply no person signed in to the portal <em>at all</em>. <br />We might be able to help you if you let us know the problem you're trying to solve. And no, "comparing session attributes with something" doesn't count as a problem. Use Business Terms: What are the requirements, what is the story, that you're trying to implement?Olaf Kock2020-02-27T15:50:29ZRE: Access to Session Attributes from WorkflowDaniel Ghttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186049002020-02-27T13:35:00Z2020-02-27T13:35:00ZThanks, but this option is not possible for me because I have to compare this attribute in navigations so has to be stored in session.<br /><br />I've tried also this: PortalSessionThreadLocal.getHttpSession();<br />but it does not work neither.<br /><br />RegardsDaniel G2020-02-27T13:35:00ZRE: Access to Session Attributes from WorkflowMohammed Yasinhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186069092020-02-27T11:30:24Z2020-02-27T11:30:24ZSimplest way is you persist this information in Database and then retrieve , update etc Mohammed Yasin2020-02-27T11:30:24ZRE: Access to Session Attributes from WorkflowDaniel Ghttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186065632020-02-27T10:48:05Z2020-02-27T10:48:05ZThanks both of you.I have a custom parameter which store a list of ids. This list is modified in a portlet and should be modified with this workflow too. So I can't pass it when the workflow starts because it could be modified by the portlet. Morevoer, I need to store again the value in session when executing the workflow, so I need to access to this parameter during the task, for getting the value and for storing it again.<br />Any ideas?<br /><br />Thanks again!Daniel G2020-02-27T10:48:05ZRE: Access to Session Attributes from WorkflowOlaf Kockhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186041502020-02-27T10:30:41Z2020-02-27T10:30:41Z<div class="quote-title">Daniel G:</div><blockquote> I want to access to the attributes that are stored in session when a workflow task is executed. I've tried many things but I'm not able to do it.<br /></blockquote>A workflow might run outside of any request, thus there's no request available. <em>What kind</em> of data are you looking for, to solve <em>which</em> problem?Olaf Kock2020-02-27T10:30:41ZRE: Access to Session Attributes from WorkflowMohammed Yasinhttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186061952020-02-27T10:22:22Z2020-02-27T10:22:22ZHi, Are you looking for some particular data from session object while executing workflow task ? You can rather store that data/object in servicecontext while initiating the workflow and use it while executing task.Mohammed Yasin2020-02-27T10:22:22ZAccess to Session Attributes from WorkflowDaniel Ghttps://liferay.dev/en/c/message_boards/find_message?p_l_id=119785333&messageId=1186054622020-02-27T09:01:12Z2020-02-27T09:01:12Z<html><head></head><body>Hi.<br>I want to access to the attributes that are stored in session when a workflow task is executed. I've tried many things but I'm not able to do it.<pre><code>HttpServletRequest httpServletRequest = serviceContext.getRequest();&nbsp;&nbsp; &nbsp;&