User (People picker) field
Search and select one or more Microsoft 365 / Entra users via the People Picker, backed by SharePoint's User column.
The User field is a people picker, type a name or email, get autocomplete results
from your tenant's directory (via Microsoft Graph), pick one or many. Binds to
SharePoint's User column type.
The value stored is the SharePoint user id; the display name is resolved at render time.
Common properties
| Property | Description |
|---|---|
labelstring | Visible label. |
descriptionstring | Helper text. |
requiredboolean default: false | Marks the field required. |
readOnlyboolean default: false | Disables the picker, the selected person is still shown. |
Type-specific properties
| Property | Description |
|---|---|
allowMultipleboolean default: false | Allow picking more than one person. When on, the value is a persona array instead of a single persona. |
chooseFromType'peopleOnly' | 'peopleAndGroups' default: 'peopleOnly' | What the autocomplete may resolve, individual users only, or users plus AD / SharePoint groups. |
JavaScript recipes
Read the selected person(s)
const person = f365.field('Owner').value as { id: number; loginName: string; email: string } | null;
// ^ for allowMultiple, returns an array of the same persona shape instead.
const id = person?.id ?? null;
Default to the current user
f365.events.onLoad(() => {
if (f365.context.displayMode !== 'new') return;
if (f365.field('Owner').value) return; // don't clobber an existing pick
// Assigning a login string lets the user column resolve it on save.
f365.field('Owner').value = f365.user.current().loginName;
});
Auto-fill an email field from the picked person
f365.events.onChange(async (e) => {
if (e.fieldKey !== 'Owner') return;
const persona = e.newValue as { id: number; email: string } | null;
if (!persona?.id) {
f365.field('OwnerEmail').clear();
return;
}
const user = await f365.user.byId(persona.id);
f365.field('OwnerEmail').value = user?.email ?? '';
});
Block save unless the approver is in a group
f365.events.onBeforeSave(async () => {
const approver = f365.field('Approver').value as { id: number } | null;
if (approver?.id && !(await f365.user.isInGroup('Approvers', approver.id))) {
await f365.ui.showAlert('The selected approver is not a member of the Approvers group.');
return false; // cancels the save, keeps the form open
}
return true;
});
Related
Related articles
- Lookup field
Search and pick from another SharePoint list, typeahead autocomplete with a configurable display column.
- Person control
A richer people picker, surfaces user metadata (job title, department, manager) alongside the name.