UserSelect
A user of the current tenant, e.g. the budget owner of a request. A searchable BelongsTo on the user accounts.
use Anvil\Schema\Fields\UserSelect;
UserSelect::make('budget_owner_id')->label('Budget owner')->required(),UserSelect::make('reviewer_id')->helperText('Gets a task when the request is submitted.'),Who can be chosen
Section titled “Who can be chosen”Everybody who may fill the form can choose a user – the field does not
go through the user administration and does not need users.view. To keep
that safe it:
- offers only active users who are members of the current tenant,
- shows their username, never e-mail addresses,
- sends only UUIDs to the browser.
Options
Section titled “Options”The options of BelongsTo: searchable() is
already set (change the number of hits with searchable(true, 50));
relationship() is not needed. Plus the
options of every field.
Saved value, validation, read-only, API
Section titled “Saved value, validation, read-only, API”As for a searchable BelongsTo: the internal user id is saved, the submitted UUID must be a user that may be chosen, the detail page shows the username, the API uses the UUID of the user.