Wednesday, 6 June 2012

Creating Additional information fields for Liferay User entity

The typical way of adding fields for a Liferay entity (e.g. User) is using Liferay’s Expando mechanism. Open the Control Panel in Liferay and click on the ‘Custom Fields’ entry in the left hand navigation. You will see that it presents a table of the different Liferay entities that you can add custom fields to. Luckily one of these is User.

Click the row for User and then click on the ‘Add’ button. For this example lets choose ‘industry’ for the key and for the type choose Selection of Text Values.

Once that’s completed you will see this entry added to the custom fields table in the Control Panel for the User entity. Next click on the ‘Actions’ button and then click on the ‘Edit’ entry offered in the context menu. Add the following values in the text box presented for the ‘Default Attribute’ field:

Information Technology

Be sure to save those changes and go back to the previous page that displays the ‘Actions’ button. Click it again and this time mark the checkboxes for update and view for the roles labeled as ‘Guest’, ‘User’, and ‘Power User’. If you forget to do so you are likely to see exceptions on your console when you later add this field to your password reset question page.

No comments:

Post a Comment