Message Boards

LR-7 Store value in portal.properties

thumbnail
Nirav Prajapati, modified 3 Years ago.

LR-7 Store value in portal.properties

Regular Member Posts: 133 Join Date: 6/25/15 Recent Posts
Hello friends,
I am using Liferay 7.2

I want to store value in portal.properties file.

I have tried with PropsUtil ( both com.liferay.portal.kernal. and com.liferay.portal.util.) , but after restarting the server the key's value getting reset.

Means after server restart it getting null value.

Please help me into it.

Thanks in advance.
thumbnail
Ian Gosling, modified 3 Years ago.

RE: LR-7 Store value in portal.properties

New Member Posts: 8 Join Date: 3/19/12 Recent Posts
I think the accepted practice is to create a portal.properties or portlet.properties file in a custom module. You can write your own  class method to get the value.
thumbnail
Mohammed Yasin, modified 3 Years ago.

RE: LR-7 Store value in portal.properties

Liferay Master Posts: 591 Join Date: 8/8/14 Recent Posts
Hi,
You can also try implementing System Configuration , for saving custom properties.
https://help.liferay.com/hc/en-us/articles/360018161391-Making-Your-Applications-Configurable
thumbnail
Nirav Prajapati, modified 3 Years ago.

RE: LR-7 Store value in portal.properties

Regular Member Posts: 133 Join Date: 6/25/15 Recent Posts
Hello Mohammad,
Actually, I am trying to make own email template for email send.
Like whatever build in liferay for email sending on account creation, password reset like that.
Instance Setting > Email
Can you please let me know how to get it..
thumbnail
Christoph Rabel, modified 3 Years ago.

RE: LR-7 Store value in portal.properties

Liferay Legend Posts: 1554 Join Date: 9/24/09 Recent Posts
Do you want to use it in your own application? How do you want to send the email? You have several options.
a) You could indeed add it to portal-ext.properties, but I would not recommend that. It will be messy, since you should just add some short config options there, not whole documents
b) You could use a webcontent article for it. Then you would only need to store the ID of the webcontent somewhere. Editors can then just edit the article and you would only need to read it using the API where you send the email.
c) You could add a configuration. You will only have a text editor there, but it could be sufficient if you don't plan to do something fancy.
https://help.liferay.com/hc/en-us/articles/360018161391-Making-Your-Applications-Configurable
d) You could create your own service to store the email template. This approach is pretty powerful, but if you need it only once or twice, it probably doesn't pay off.