How to Filter Multiple departments

Hi,

I am new to plumsail and my agency is using sharepoint and use the plumsail to configure the org chart.

I have a section now that i need to include one more department in the Filtration section. Can pls someone help me to add another department.

below is my current code and i need to add Finance

function(itemData){

//You can get field values like this: itemData["Department"]
//Example: return itemData["Department"] == "Marketing";

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

Pls help. Thank you

Regards,
France

Hello @FranceSy,

The filtration syntax is essentially just JavaScript. You can use the following code to only display people from Marketing and Finance departments:

function(itemData){
   return itemData["Department"] == "Marketing" || itemData["Department"] == "Finance";
}

In the future, if there are a lot of departments you would need to filter on, I'd recommend using the following code:

function(itemData){
   let departments = ["Marketing", "Purchasing", "Analytics", "Finance"];

   return departments.includes(itemData["Department"]);
}    

Hope this helps!

Dear A. Cox

This works like a charm. Thank you so much for your great assistance.

France

1 Like

Dear @FranceSy,

You are very welcome!