Fórum

Accesing Portlet Preferences using Javascript Liferay 6.1.1

Raul Arabaolaza, modificado 11 Anos atrás.

Accesing Portlet Preferences using Javascript Liferay 6.1.1

New Member Postagens: 2 Data de Entrada: 16/02/13 Postagens Recentes
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
thumbnail
Chirag Patadia, modificado 11 Anos atrás.

RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1

Junior Member Postagens: 29 Data de Entrada: 03/02/12 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1

New Member Postagens: 2 Data de Entrada: 16/02/13 Postagens Recentes
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, modificado 11 Anos atrás.

RE: Accesing Portlet Preferences using Javascript Liferay 6.1.1

Junior Member Postagens: 34 Data de Entrada: 29/10/12 Postagens Recentes
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.