What 'type' parameter should I provide to the addUser() function when creating a User through API?
written-by
Adorjan Meszaros
How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!
While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.
legacy-article
learn-legacy-article-disclaimer-text
Issue
- I would like to create a user via UserLocalServiceUtil.addUser()
- One of the parameters required is 'int type'.
- What value should I provide to this type parameter?
Environment
- DXP 7.4
- Quarterly Releases
Resolution
- The type parameter defines the user in a global scope:
- 0: GUEST (e.g. for Commerce use cases);
- 1: REGULAR;
- 2: DEFAULT_SERVICE_ACCOUNT
- For the purpose of creating a new user, type should be 1.
did-this-article-resolve-your-issue