Thursday, 9 July 2015

Liferay Custom field and Expando Tables

Creating Extra Field

If you want to add extra field in liferay default table ......
 In 6.2
Admin-------------->control panel--------->Custom Fields---------->User

select entity for ex..User

User-------->Add Custom Field -------->Enter Key &  Type and save it 




Saving The Custom field value

 
in jsp page
 <%
      User currentUser = themeDisplay.getUser();
          %>
          <div class="control-group">
            <label for="reportingManager" class="control-label">Reporting Manager</label>
            <div class="controls">
              <liferay-ui:custom-attribute-list
              className="<%= User.class.getName() %>"
              classPK="<%= currentUser != null ? currentUser.getUserId() : 0 %>"
              editable="<%= true %>" label="false"/>
            </div>
          </div>   
in controller
  ServiceContext serviceContext = ServiceContextFactory.getInstance(User.class.getName(),      actionRequest);
    user.setExpandoBridgeAttributes(serviceContext);
    UserLocalServiceUtil.addUser(user);


After creating custom field ,it is available in ExpandoTable and ExpandoColumn

After Saving You can check it in ExpandoValue Table



 

No comments:

Post a Comment