Used to get the current org chart as a tree to create a new org chart tree or a new item or to save the configured tree as the current org chart.

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) { 
    // Validation successful 
    const sErrs = await System. organisationStructure.save(tree); 
} 

Hierarchy

  • OrganisationStructure

Methods

createItem

  • The method allows you to create a new item of the organizational chart.

    Parameters

    • name: string

      Name of the new item.

    • type: OrganisationStructureItemType

      Type of the new item.

      const item = System. organisationStructure.createItem('Head of Marketing',  OrganisationStructureItemType.Position);
      

    Returns OrganisationStructureItem

createTree

  • The method creates a new organizational chart tree.

    Parameters

    • rootName: string

      Name of the root position in the tree.

      const tree = System. organisationStructure.createTree('CEO');
      

      A tree containing only the root item will be created.

    Returns OrganisationStructureTree

fetchTree

  • The method is used to load the current org chart tree.

    const tree = await System.organisationStructure.fetchTree();
    

    Returns Promise<OrganisationStructureTree>

save

  • The method saves the configured tree as the current org chart.

    Before saving, the org chart will be automatically validated.

    Parameters

    • tree: OrganisationStructureTree

      Tree that is being saved.

      const errs = await System. organisationStructure.save(tree);
      if (errs.length === 0) { 
           //Saved  successfully 
      } 
      If the tree is not saved, the method returns an array with  errors. 
      If the tree is saved successfully, it returns an empty array. 
      

    Returns Promise<ErrorObject[]>

search

  • The method is used to perform search in the org chart.

    You can use this method to filter, start extraction from a specific item, limit selection, sort, get the first result, or get the results page.
    Example:

    const position = await System.organisationStructure .search().where(position => position.name.eq('CEO')).first();
    

    Returns OrganisationStructureSearch