Hierarchy
- OrganisationStructureTree
Methods
find
-
The method searches for an org chart item by name.
The method will return the first suitable item or "undefined" if no items are found.
Parameters
-
name: string
Name of the item.
const item = tree.find('Procurement department'); if (item === undefined) { // Item not found }
Returns OrganisationStructureItem | undefined
-
getRoot
-
The method allows you to create a new item of the organizational chart.
const tree = await System.organisationStructure.fetchTree(); const root = tree.getRoot();
Returns OrganisationStructureItem
validate
-
The method validates the org chart.
const errs = await tree.validate(); if (errs.length === 0) { // Validation successful }
If validation fails, the method returns an array with errors. If validation is successful, it returns an empty array.
Returns Promise<ErrorObject[]>
Organizational chart tree object
The organizational chart as a tree structure. It is used to get the root of the organizational chart, to search an item by name, and to validate the org chart tree. The type has no constructor. A new item can be created using the OrganisationStructure.createTree method:
const tree = System.organisationStructure.createTree('CEO');
The current org chart tree can be loaded using the OrganisationStructure.fetchTree method:
const tree = await System.organisationStructure. fetchTree(); const newItem = System.organisationStructure.createItem( 'Marketing Director', OrganisationStructureItemType.Position); tree. getRoot().addChild(newItem); const errs = await tree.validate(); if ( errs.length === 0) { // Validated successfully }