Taxonomy field
Pick from a SharePoint Managed Metadata term set, single or multi-level, single or multi-select.
The Taxonomy field picks from a SharePoint Managed Metadata term set. The picker shows the term hierarchy with expandable nodes. When the field is bound to a SharePoint column, the term set, starting term and single or multiple selection all come from the column and are re-read every time the form loads.
Common properties
| Property | Description |
|---|---|
labelstring | Visible label. |
descriptionstring | Helper text. |
requiredboolean default: false | Marks the field required. |
readOnlyboolean default: false | Disables editing. |
Type-specific properties
| Property | Description |
|---|---|
termSetIdGUID | Target term set. Inherited from the SP column setting. |
anchorTermIdGUID | Optional anchor term, scopes the search and tree to this subtree only. |
allowMultipleboolean default: false | Allow selecting multiple terms. |
isPathRenderedboolean | Read-only mirror of the column display setting: show the full term path (Parent › Child) or the label only. |
termDisplay'label' | 'path' | Author override of the column display setting. Leave unset to follow the column. |
formAnchorTermIdGUID | Designer "Where the choices start: a fixed term". Starts the choices at a term inside what the column allows. |
anchorFromFieldstring | Designer "The term picked in another field" (cascade). The field waits until that field has a value, starts its choices there, and is cleared, with Undo, when that value changes. |
leafOnlyboolean default: false | Only the lowest-level terms can be picked; parent terms just expand. |
excludedTermIdsGUID[] | Terms hidden from suggestions and the browse tree on this form. |
termSetOpenboolean | Read-only mirror of the SP Open flag, the term set allows fill-in terms. |
isKeywordboolean | Read-only mirror of the SP IsKeyword flag, global keyword term set. |
createValuesInEditFormboolean | Read-only mirror of SP CreateValuesInEditForm (the column allows fill-in). Adding new terms from the form is not available yet. |
JavaScript recipes
Read the selected term(s)
const tag = f365.field('Category').value;
// single: { id, label, path? } or null
// multi: [{ id, label, path? }, ...] or []
// `id` is the term GUID. Compare on it: labels can be renamed.
Set a term
// By term GUID (unambiguous):
f365.field('Category').value = 'aaaaaaaa-1111-2222-3333-444444444444';
// By label: must match exactly one term in the term set.
f365.field('Category').value = 'Finance';
// Multi: an array of ids, labels or { id, label }. [] clears it.
f365.field('Tags').value = ['Finance', 'Operations'];
The write looks the term up in the term store, so it finishes a moment later. If a label matches no term, or more than one, the field is left unchanged and the reason is logged to the browser console.
Cascade in code: start one field under another's term
// The no-code way is the designer's "Where the choices start" setting.
// In code, follow any rule you like:
f365.field('Region').on('change', () => {
const region = f365.field('Region').value; // { id, label } or null
f365
.field('Country')
.asTaxonomy()
.setAnchor(region ? region.id : null);
});
Look terms up without opening the picker
const tax = f365.field('Category').asTaxonomy();
const hits = await tax.search('Fin'); // [{ id, label, path, hasChildren }]
const kids = await tax.children(hits[0].id);
const info = await tax.term(hits[0].id); // includes isDeprecated
Require a tag before save
f365.events.onBeforeSave(async () => {
const tag = f365.field('Category').value;
if (!tag || (Array.isArray(tag) && tag.length === 0)) {
await f365.ui.showAlert('Pick at least one category before submitting.');
return false; // cancel the save
}
return true;
});
Show a related field when a tag is chosen
f365.events.onChange((e) => {
if (e.fieldKey !== 'Category') return;
const hasTag = Array.isArray(e.newValue) ? e.newValue.length > 0 : Boolean(e.newValue);
f365.field('CategoryNotes').visible = hasTag;
});
Related
Related articles
- Choice field
Single-select from a fixed list of options, rendered as a dropdown, a radio group, or compact pills.
- Lookup field
Search and pick from another SharePoint list, typeahead autocomplete with a configurable display column.