Filtering Disabled Users

We have been trying to figure out the correct syntax, which will enable us to filter out disabled user accounts. We need to keep this accounts active in Active Directory, but do not want them displaying in the Org Chart. We have decided to “blank out” the Title field in the applicable User AD Properties and use this as the field we want the filter to act against. We have used the following syntax without success:

[color=#FF0000]return itemData[“Title”] != “”;
return true;

or

return itemData[“Title”] != null;
return true;
[/color]

Any assistance would be great.

Hello,

Thank you for your question.

We use JavaScript based syntax for filtration function. So, you can use such filtration function:

function(itemData){ return itemDate["SPS-JobTitle"] || itemDate["Title"]; }

Such expression ensures that at least one of specified properties is not empty.

I checked two properties “SPS-JobTitle” and “Title” because they both can store information about job title in user profile.

Best regards
Anton Khritonenkov

You had a typo in the example you provided, but after correcting, it worked as designed. Thanks for the help.

function(itemData){
return [color=#FF0000]itemDate[/color][“SPS-JobTitle”] || [color=#FF0000]itemDate[/color][“Title”];
}

should be:

function(itemData){
return [color=#008000]itemData[/color][“SPS-JobTitle”] ||[color=#008000] itemData[/color][“Title”];
}

Hello,

Thank you for correction.

Best regards
Anton Khritonenkov
Plumsail Team

Is there a way that you can filter out disable users by their account status being disabled?

Hi Turtlgal,

You have two options to hide disabled users from the chart:

  1. You may set a user to have no manager, here you will find how to do it.

  2. You may also hide such employees by creating a department called, fox example “Off company”, putting disabled employees in this department and filtering the department out of the chart like this:

function(itemData){
   return itemData["Department"] != "Off company";
}

Anna,
I have users with no managers that show up when I do a search. Any ideas?

Anna,
The users don’t show in the Org Chart itself, but they do show in searches. Is there anyway I can filter them out of the search, maybe something that filters on Manager is not Null/Empty?

Hi @turtlgal,

If you applied filtration function on Filtration step of the configuration wizard, it works for whole Org Chart including search results.

If you still see those employees, there are two possible reasons:

Anton,
Im not sure what to put in to the Filtration step to make it where Manager is not empty.

Can anyone help me with what filtration I would use for Manager is not empty? @Anna @antonkhrit

Hi @turtlgal,

You can hide users without managers from search. But if they have subordinates, they will be still searchable. So, it is difficult to hide subtrees from search. But if you are ok with just hiding employees without manager, here is instruction:

  1. Set Root ID to make sure your root employee (probably CEO) is not omitted.
  2. Add this part to filtration function:

If you have some other exression in filtraion function, you should add isManagerFilled to your existing expression.

function(itemData){

  var isManagerFilled = itemData["Manager"];

  return isManagerFilled;
  
}

So I can apply the root id, but when I apply the filtration after that it no longer can see the root ID.
Is there a way to add an except or else statement?

What version of Org Chart do you use? You can see in on the last page of the config wizard. The latest Office 365 version always displays person with root.

Anyway you always can add exclusion of root employee to your condition like this:

function(itemData){

  var isManagerFilled = itemData["Manager"];

  return isManagerFilled || itemData["AccountName"].contains("ROOT_ACCOUNT_NAME");
  
}

Replace ROOT_ACCOUNT_NAME with account name of your root employee.

@antonkhrit
That worked! thank you. and Im using 3.1.3

Hi Anna,
Where is this javascript file so, I can add these javascript functions.

Thanks!

Hi, indirimkodu

You need to add this script on the “Filtration” step of the configuration wizard.

@antonkhrit

I am using version Version 3.2.2 and tried to use the suggestion for removing disabled users from search after verifying their Manager is empty (has been for some time now) and they still show up when using the search function. I have also cleared the cache within the org chart app. Any other suggestions on how to remove these users from showing up in the search function?

function(itemData){

var isManagerFilled = itemData[“Manager”];

return isManagerFilled || itemData[“AccountName”].contains(“ROOT_ACCOUNT_NAME”);

}

TIA

Hello @Jaime,

We tested it another time in the last version of Org Chart (3.2.3). It worked fine.

Please, make sure you insert the code into a field on the Filtration step of the configuration wizard and check if you are using correct quotation marks. Using " or is OK, but symbol will not work.

function(itemData){
    var isManagerFilled = itemData['Manager'];
    return isManagerFilled || itemData['AccountName'].contains('ROOT_ACCOUNT_NAME');
} 

If it does not help please try to upgrade to the version 3.2.3.

Best Regards,
Anna Dorokhova
Plumsail Team

Thank you Anna. that ’ change seemed to make the difference.

1 Like