Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
Access to Session Attributes from Workflow
Hi.
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.
Could anyone help me? Thanks in advance!
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.
HttpServletRequest httpServletRequest = serviceContext.getRequest(); HttpSession httpSession = httpServletRequest.getSession();
List<long>gruposCarencia= ( List<long>)httpSession.getAttribute("LIFERAY_SHARED_GruposCarencia");
</long></long>
This is always null because serviceContext.getRequest() is null.Could anyone help me? Thanks in advance!
Hi, 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.
Daniel G:
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.A workflow might run outside of any request, thus there's no request available. What kind of data are you looking for, to solve which problem?
Thanks 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.
Any ideas?
Thanks again!
Any ideas?
Thanks again!
Simplest way is you persist this information in Database and then retrieve , update etc
Thanks, but this option is not possible for me because I have to compare this attribute in navigations so has to be stored in session.
I've tried also this: PortalSessionThreadLocal.getHttpSession();
but it does not work neither.
Regards
I've tried also this: PortalSessionThreadLocal.getHttpSession();
but it does not work neither.
Regards
That's because workflow scripts are not tied to a HttpRequest - they can be triggered by API calls, e.g. timer based, when there's simply no person signed in to the portal at all.
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?
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?
Thanks for the answer.
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.
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.
Regards.
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.
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.
Regards.
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™