SharePoint Experts Blog

Org Chart tip: How to hide assistant from subordinates

Update: Org Chart does everything automatically for you since version 2.2.28. It checks if there is already assistant box in the structure and hides subordinate box.

We have separate fields to store information about manager and assistant in user profiles or SharePoint list data sources. So, it is possible that assistant of specific employee has the same employee as a manager. This brings us to duplicated boxes in the org chart. As you see below, Derek Clark is an assistant of David Navarro and at the same time David Navarro is a manager for Derek Clark.

AssistantDuplicate

 

I will show how to hide assistant from subordinates and display it as assistant only. I will use job title and box context in the configuration wizard to specify appropriate filtration rule.

This is my filtration rule

function(itemData, context){ 
 
 var jobTitleFiled = "Title";
 return context.itemType == "Assistant" || context.itemType == "Item" && !itemData[jobTitleFiled].toLocaleLowerCase().contains("assistant")
 
}

You can just copy and paste this code to org chart configuration wizard on “Filtration” step if you use user profiles as a data source. You may need to specify your own filed internal name for job title field if you use SharePoint list as a data source. Just replace var jobTitleFiled = “Title” with your field name.

This filtration rule allows to display all assistant boxes and all subordinate boxes except subordinate boxes with job title which contains “assistant” keyword.

As result I have such org chart with single assistant box:

AssistantSingleBox

I hope this tip will be helpful for you. Feel free to comment.

Posted in: Org Chart

  • Tesfaye Gari
    This doesnt work for me. I have a column called IsAssistant that is Y or Empty. How can I remove them from showing when it is Y
    • Hi Tesfaye,If your property name “IsAssistant” is correct internal name of property in user profiles, then such filtration function should work for you:function(itemData, context){return context.itemType == “Assistant” || context.itemType == “Item” && !itemData["IsAssistant"]}
      • Tesfaye Gari
        Hi Anton; Thank you for the quick response. I am not using user profile. I am using SharePoint List please assist
        • Hi Tesfaye,It has to work for SharePoint list as well if internal name for your IsAssistant column is “IsAssistant”.
          • Tesfaye Gari
            Cant I have the default filtration function and the custom function you posted on here. I can only use the defaultfunction(itemData){//You can get field values like this: itemData["Department"]//Example: return itemData["Department"] == “Marketing”;return true;} ORfunction(itemData, context){return context.itemType == “Assistant” || context.itemType == “Item” && !itemData["IsAssistant"];}Why both doesnt work together? This has an issue. If you click to drill down the Assistant it doesnt work if only the custom Filteration is used
          • Hi Tesfaye,The second function has to handle both cases: -hiding assistant from subordinates -showing standard boxesWe sen’t you screen sharing request in your help desk ticket to analyze the issue on your side.
          • Tesfaye Gari
            I didnt get any link for the meeting request in my email.
          • Hi Tesfaye. Thank you for screen sharing session.