User Selection fields in Kintone can hold information of multiple users. The number of users that can be selected for the value though cannot be controlled with Kintone's built-in features.
There are some cases though where we would like to use the User Selection field for selecting managers or ticket requestors, and those fields should usually only consist of one user.
This article introduces a customization to allow only one user to be selected in the User selection field.
Prepare the App where you would like to apply the customization. The only field needed for this customization to run is the User Selection field, so make sure this field is included, and take note of the field code.
- Events need to be set for pages where fields can be edited - the Record Create, Record Edit and Record List pages. Make sure to list all related events in the code:
- The User Selection field holds values in an array. If the length of the array is 2 or more, the code places an error message inside event.error and returns the event object.
Test the Customization
Apply this source code to the Kintone App prepared in the previous steps.
Try specifying 2 or more users in the User Selection field on the Record Create page, Record Edit page and the Record List page. If successful, and error message will appear, and the user will not be able to save the record.