Fórum
Problem with UserLocalServiceUtil.addUser LF 6.06
J W, modificado 12 Anos atrás.
Problem with UserLocalServiceUtil.addUser LF 6.06
New Member Postagens: 5 Data de Entrada: 08/06/11 Postagens Recentes
Hi guys,
I am trying to add a new User to Liferay within a custom portlet.
In my Portlet you are able to upload a csv file. This file is parsed and it's values are used for the UserLocalServiceUtil.addUser method.
Heres a snippet of my code:
By calling the above code I get the following error:
java.lang.Exception: com.liferay.portal.NoSuchUserException: No User exists with the primary key 11526.........
I Hope you can help me with this problem.
thanks in advance
I am trying to add a new User to Liferay within a custom portlet.
In my Portlet you are able to upload a csv file. This file is parsed and it's values are used for the UserLocalServiceUtil.addUser method.
Heres a snippet of my code:
User createdUser = UserLocalServiceUtil.addUser(
CounterLocalServiceUtil.increment(),
new Long("10131"),
false,
password,
password,
false,
screenName,
email,
0L,
"",
Locale.getDefault(),
firstName,
"",
lastName,
0,
0,
false,
Calendar.JANUARY,
1,
1970,
"",
null,
null,
null,
null,
false,
ServiceContextFactory.getInstance(actionRequest));
By calling the above code I get the following error:
java.lang.Exception: com.liferay.portal.NoSuchUserException: No User exists with the primary key 11526.........
I Hope you can help me with this problem.
thanks in advance
Cédric Briançon, modificado 12 Anos atrás.
RE: Problem with UserLocalServiceUtil.addUser LF 6.06
New Member Postagens: 17 Data de Entrada: 28/10/10 Postagens Recentes
Hi,
I've done the same in an extension of the control panel. I didn't use UserLocalServiceUtil but UserServiceUtil directly, this way :
Regards,
Cédric
I've done the same in an extension of the control panel. I didn't use UserLocalServiceUtil but UserServiceUtil directly, this way :
UserServiceUtil.addUser(companyId, true, "", "", false, screenName, email, 0L, "", locale, firstName,
"", lastName, 0, 0, true, 1, 1, 1970, "", groupIds, orgIds, null, null, true, 0L, null);
Regards,
Cédric
Jan Gregor, modificado 12 Anos atrás.
RE: Problem with UserLocalServiceUtil.addUser LF 6.06
Regular Member Postagens: 224 Data de Entrada: 20/10/10 Postagens Recentes
The problem you are having is because first parameter. First parameter is creatorUsedId. You can use for this parameter following code:
Regards,
Jan.
UserLocalServiceUtil.getDefaultUserId(companyId)
Regards,
Jan.