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
RE: Reading portlet preference in Scheduler of the portlet
Hi,
Can I get portletPreference of my portlet in the scheduler of the same portlet.
Regards,
Liferay Questions
Can I get portletPreference of my portlet in the scheduler of the same portlet.
Regards,
Liferay Questions
Shagul Khajamohideen, modified 14 Years ago.
Liferay Master
Posts: 758
Join Date: 9/27/07
Recent Posts
Liferay Question:
Hi,
Can I get portletPreference of my portlet in the scheduler of the same portlet.
Regards,
Liferay Questions
As you may know , portlet preferences belong to the portlet (portletId) in a page (plid). If the portlet is instanceable then the portletId will be that of the portlet instance id. Portlet preferences are stored in the database and com.liferay.portal.util.PrefsPropsUtil.java can be used as an example on how to retrieve those preferences using the PortletPreferencesLocalServiceUtil.
Hi Shagul,
Thanks for your reply.
Yes the only problem i find now is how to find the plid of a portlet in a scheduler, because all i have there is a companyId.
Regards,
Liferay Questions.
Thanks for your reply.
Yes the only problem i find now is how to find the plid of a portlet in a scheduler, because all i have there is a companyId.
Regards,
Liferay Questions.
Clark - did you ever find a solution to this? I have a similar use case, and before I post a new question I'm hoping you might've found an answer

Hi Andrew,
Did you get solution for this case?
Did you get solution for this case?

Hi,
I used portlet schedulers back in 5.2.3 and if it wasn't changed, you don't have access to such objects. The scheduler is run only once, not per portlet instance, right?
If I remember, the scheduler is defined for the portlet as a whole (you define one scheduler class in liferay-portlet.xml per portlet), that means one scheduler for all instances of the portlet in the whole portal, on all pages.
I'm not sure how this works with more companies in portal, but I assume this is not your case and you have only one company.
If you want to do some portlet preferences update for one portlet instance located on some page, you have to define plid (page's id, e.g. 10520) and portletId (instance id, e.g. _mybusinessapplicationportlet_WAR_myportlet_INSTANCE_FqL4) in some properties file and read this file from scheduler. Then you can load portlet preferences of such portlet instance via:
I used portlet schedulers back in 5.2.3 and if it wasn't changed, you don't have access to such objects. The scheduler is run only once, not per portlet instance, right?
If I remember, the scheduler is defined for the portlet as a whole (you define one scheduler class in liferay-portlet.xml per portlet), that means one scheduler for all instances of the portlet in the whole portal, on all pages.
I'm not sure how this works with more companies in portal, but I assume this is not your case and you have only one company.
If you want to do some portlet preferences update for one portlet instance located on some page, you have to define plid (page's id, e.g. 10520) and portletId (instance id, e.g. _mybusinessapplicationportlet_WAR_myportlet_INSTANCE_FqL4) in some properties file and read this file from scheduler. Then you can load portlet preferences of such portlet instance via:
Layout layout = LayoutLocalServiceUtil.getLayout(plid);
javax.portlet.PortletPreferences prefs = PortletPreferencesFactoryUtil.getLayoutPortletSetup(layout, portletId);
Hello ..
Sorry to open up this old thread, but in my case I actually have multiple companies ( portal instances ) and need to run the same scheduler job on all the instances. I have a thread posted here. Any pointers ?
Thanks
Abhay
Sorry to open up this old thread, but in my case I actually have multiple companies ( portal instances ) and need to run the same scheduler job on all the instances. I have a thread posted here. Any pointers ?
Thanks
Abhay
Copyright © 2025 Liferay, Inc
• Privacy Policy
Powered by Liferay™