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

PropertyDescription
label
string
Visible label.
description
string
Helper text.
required
boolean
default: false
Marks the field required.
readOnly
boolean
default: false
Disables editing.

Type-specific properties

PropertyDescription
termSetId
GUID
Target term set. Inherited from the SP column setting.
anchorTermId
GUID
Optional anchor term, scopes the search and tree to this subtree only.
allowMultiple
boolean
default: false
Allow selecting multiple terms.
isPathRendered
boolean
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.
formAnchorTermId
GUID
Designer "Where the choices start: a fixed term". Starts the choices at a term inside what the column allows.
anchorFromField
string
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.
leafOnly
boolean
default: false
Only the lowest-level terms can be picked; parent terms just expand.
excludedTermIds
GUID[]
Terms hidden from suggestions and the browse tree on this form.
termSetOpen
boolean
Read-only mirror of the SP Open flag, the term set allows fill-in terms.
isKeyword
boolean
Read-only mirror of the SP IsKeyword flag, global keyword term set.
createValuesInEditForm
boolean
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 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.