Search code examples
liferayhookliferay-6liferay-themeliferay-aui

Issue while inserting the user in liferay


I have created a form which has basic user details and on clinking of the Save button I am inserting the user details in the "USER_" table by calling the UserLocalServiceUtil.addUser(....). Now the user is creating with out any issue. But I am not able to see some form field parameters in UserLocalServiceUtil.addUser(....) method like (Title, Gender and Date Of Birth). Now how can I save this values. Please give me some suggestions that how can I insert the following fields (Title, Gender and Date Of Birth) at the time of user creation.


Solution

  • Liferay uses com.liferay.portal.model.Contact entity to store the contact information.

    Use com.liferay.portal.service.ContactLocalServiceUtil.addContact method to create the contact. Significant parametres:

    • userId - Id of the user that is creating the contact. You can use PortalUtil.getUser method to get the current user from a request.
    • className - "com.liferay.portal.model.User".
    • classPK - Id of the new user that the contact is created for.