Is it possible to add Extra Fields Under Create User in Liferay

前端 未结 5 708
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-29 13:06

I am using Liferay 6 for portal Development . During Creating Users under Liferay , i need to add some extra Fields also ?? Please let me know if this is ppossible or not ??

5条回答
  •  盖世英雄少女心
    2020-12-29 13:42

    Yes, you can use Custom Attributes functionality for liferay entities (in your case, User) and can add as many extra fields as necessary for each liferay entity.

    Custom field for the user-entity can be created through:
    Control Panel -> Portal -> Custom Fields -> User.

    And programmatically can be created as follows:

    user.getExpandoBridge().addAttribute("yourCustomFieldKey");
    

    Then set the value as:

    user.getExpandoBridge().setAttribute("yourCustomFieldKey", "valueForCustomField");
    

    If your custom field is already present you can check like this:

    if (user.getExpandoBridge().hasAttribute("yourCustomFieldKey")) { ... };
    

    The data is stored in tables prefixed with "EXPANDO":

    • EXPANDOCOLUMN: stores the custom field key and other settings (contains the tableId refrences)
    • EXPANDODATA: stores the custom field value for the key (contains the columnId and tableId refrences)
    • EXPANDOTABLE: stores for which liferay entity (user) are you adding the custom field
    • EXPANDOROW: stores linking information between a user and its values (contains tableId and userId refrences)

    Hope this helps.

提交回复
热议问题