Filtration syntax

SharePoint Org Chart allows to filter boxes using JavaScript function. This function evaluates data for org chart box and returns a boolean value. If ‘true’, then box with such data will be displayed. You can specify filtration function in the configuration wizard on filtration step.

Below you can see the snippet for filtration function:

function(itemData, context){

  //You can get field values like this: itemData["Department"]

  return true;
}

You can use itemData input parameter to access data for the current box and verify it. Use internal names of properties to access their values like this: itemData[“Department”].

Use typical JavaScript conditions, comparison operators and functions like indexOf to verify data. For example, you may need to include to org chart only employees from the specific department. In this case, the function to display employees from Marketing department looks like this:

function(itemData, context){

  return itemData["Department"] == "Marketing";
}

You may notice context input parameter in the filtration function. It is an optional parameter and in most cases, you don’t need. This parameter has property itemType. Possible values of this property:

  • item – detects regular box, dotted line subordinate or vacancy.
  • assistant – detects assistant box