Issue
- We have a Form with an Upload field where authenticated users can upload files but Guests cannot.
- All permissions are provided for Guest user.
- When the user selects the file to upload, an error message appears immediately: "An unexpected error occurred while uploading your file."
- If we add "com.liferay.dynamic.data.mapping.form.web.internal.upload.DDMFormUploadResponseHandler" with DEBUG in Server Administration > Logs, we see the following error:
DEBUG [http-nio-8080-exec-630][DDMFormUploadResponseHandler:56] null
com.liferay.portal.kernel.exception.NoSuchUserException: No User exists with the key {companyId=20101, screenName=ddm_form_default_user_screen_name}
at com.liferay.portal.service.persistence.impl.UserPersistenceImpl.findByC_SN(UserPersistenceImpl.java:4582) ~[portal-impl.jar:?]
Environment
- Liferay DXP 7.3 under Update 31
- Liferay DXP 7.4 under Update 76
Resolution
- When "Autogenerate User Screen Names" is ticked in Instance Settings > Users > Fields, the ddm form default user is created with a screen name of "ddm.form.default.user.screen.name".
- This differs from the screen name the DocumentLibraryDDMFormFieldTemplateContextContributor expects ("ddm_form_default_user_screen_name"), so any form using an upload field throws an exception.
- A fix was implemented with LPS-133096 from u76 for 7.4 and u31 for 7.3.
Additional Information
The following workaround is available:
- Navigate to Control Panel > Server Administration > Script
- Run the following script:
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.dynamic.data.mapping.constants.DDMFormConstants;
UserLocalServiceUtil.updateScreenName(userId, DDMFormConstants.DDM_FORM_DEFAULT_USER_SCREEN_NAME);
Before running the script, make sure that you create a backup from the database so that it can be restored if needed.