Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
Raul Arabaolaza
Accesing Portlet Preferences using Javascript Liferay 6.1.1
February 16, 2013 8:37 AM
Answer

Raul Arabaolaza

Rank: New Member

Posts: 2

Join Date: February 16, 2013

Recent Posts

Hi,

I´m completely new to Liferay Development so this is probably a stupid question. I need to access my Portlet non static preferences values by using Javascript.

After searching the web I´ve found that the Liferay Service PorletPreferences doesn´t allow me to read values, and haven´t found any other service related to Portlet preferences.

I´ve also found that Preferences are stored in the PorletPreferences table in database, but I´ve not found any way of querying that table with javascript using Liferay services

So, any hint in how can I access Portlet dinamic preferences in javascript?

Regards
Chirag Patadia
RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1
February 16, 2013 10:43 PM
Answer

Chirag Patadia

Rank: Junior Member

Posts: 29

Join Date: February 2, 2012

Recent Posts

Hi Raul,

You can try with below code snippet. That might solve your problem.

preferences = Packages.com.liferay.portal.util.PrefsPropsUtil.getPreferences();
value = preferences.getValue("<<preference key>>", null);
Raul Arabaolaza
RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1
February 17, 2013 3:28 AM
Answer

Raul Arabaolaza

Rank: New Member

Posts: 2

Join Date: February 16, 2013

Recent Posts

Hi Chiraq,

Thanks for the answer, unfortunately your code seems to work only when using the services administrative console, I need the javascript code to be executed by my portlet, JSP directives are not an option either.

Currently I´m thinking about creating a custom service using ServiceBuilder.

Thanks again, Raúl
Renata Siega
RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1
April 19, 2013 9:49 AM
Answer

Renata Siega

Rank: Junior Member

Posts: 34

Join Date: October 29, 2012

Recent Posts

Raul, did you find another way to retrieve the portlet preferences or have to create a custom service using ServiceBuilder? I'm stuck on that too.