Issue
- The root issue is that using
user.persist();more than once while attempting to update User data via theUserLocalServiceUtilclass fails in DXP 7.1.
Example of failed code:
user = UserLocalServiceUtil.getUser(oUserReg.getUserId()); user.setStatus(WorkflowConstants.STATUS_APPROVED user.setModifiedDate(cal.getTime()); user.persist(); user.setPasswordReset(false); user.persist();
Environment
- DXP 7.1
Resolution
- If using this method to retrieve a user and then update the user record,
user.persist()should be used only once. Theuser.persist()command always ignores the returned User the second time and fails then. - Instead,
user = UserLocalServiceUtil.updateUser(user)would need to be run a second time to successfully run theuser.persist();again.