Problem/Motivation
The error message given when a person tries to save an entity form while it is referencing a disallowed user can be misleading, saying for example that "The referenced entity (user: 4) does not exist." when in fact user 4 does exist, but does not have one of the roles permitted in the entityreference field configuration.
In most configurations the widget will be an autocomplete, or even a select, so invalid users will never be shown. However this can come up for people who copy paste because they know what input is expected and already have it, probably in entity pre-populate types of scenarios, and most commonly i bet when a user has been referenced with the autocomplete widget, the relevant role is taken away from that user, and somebody coming back to the form tries to save it (without even changing that user reference field).
The problem is that they will panic that the user got deleted somehow, then find it and see that it is there, and still not understand that in order to successfully reference that user they need to add the role back.
Steps to reproduce
- Create an entity reference field that references users ("userreference" field).
- Restrict the roles of the users that can be referenced.
- Attempt to reference a user that you know exists but does not have the relevant role by pasting in "Example Name (2)" or similar, where 2 is the user ID.
- You will get the incorrect and misleading message "The referenced entity (user: 2) does not exist."
Proposed resolution
Ideally, give a clear, specific message such as "The referenced entity (user: 4) must have one of the allowed roles (Editor)."
If not, vague but accurate messages such as "The referenced entity (user: 4) is not valid for referencing here"
Remaining tasks
- Identify how feasible case-specific language is.
- If feasible, decide if we need/want to include other more specific messaging for related situations while we do this (really only thinking of blocked users versus actually non-existent users)
- Decide on the updated message language.
- Implement.
User interface changes
Better messages.
Introduced terminology
None?
API changes
None.
Data model changes
None.
Release notes snippet