How to modify liferay addUser method to autoincrement userId ??

piyush liferay, modified 13 Years ago. Junior Member Posts: 40 Join Date: 1/2/13 Recent Posts
How to modify liferay addUser method to autoincrement userId.......
thumbnail
David H Nebinger, modified 13 Years ago. Liferay Legend Posts: 14933 Join Date: 9/2/06 Recent Posts
Um, that's done already...
Siby Mathew, modified 13 Years ago. Expert Posts: 268 Join Date: 3/4/11 Recent Posts
Hi Piyush,
If you see UserLocalServiceUtil.addUser(so many params here), you dont need to specify the userId in the params.
Liferay automatically increments the id and adds the user to the DB.

Thanks,
Siby
piyush liferay, modified 13 Years ago. Junior Member Posts: 40 Join Date: 1/2/13 Recent Posts
Siby Mathew:
Hi Piyush,
If you see UserLocalServiceUtil.addUser(so many params here), you dont need to specify the userId in the params.
Liferay automatically increments the id and adds the user to the DB.

Thanks,
Siby



but in addUser method companyId give null pointer exception how to resolve them.........
thumbnail
Tanaji M. Londhe, modified 13 Years ago. Regular Member Posts: 194 Join Date: 4/25/12 Recent Posts
Hi Piyush,
You will get companyId using following ways
1) themeDisplay.getCompanyId();
2) Company company = CompanyLocalServiceUtil.getCompanyByWebId("liferay.com");
long comapnyId = company.getCompanyId();
piyush liferay, modified 13 Years ago. Junior Member Posts: 40 Join Date: 1/2/13 Recent Posts
Tanaji M. Londhe:
Hi Piyush,
You will get companyId using following ways
1) themeDisplay.getCompanyId();
2) Company company = CompanyLocalServiceUtil.getCompanyByWebId("liferay.com");
long comapnyId = company.getCompanyId();



Problem is Not Resolve by both methods of get a companyId......
thumbnail
Tanaji M. Londhe, modified 13 Years ago. Regular Member Posts: 194 Join Date: 4/25/12 Recent Posts
How do you add the user programmatically share that code.
I have done this using following code
http://tanajilondhe.blogspot.in/2013/01/liferay-add-user-programmatically.html