Our CEO does not have manager in the O365 and Sharepoint. We would like to filter out (in Plumsail's Orgchart while using search tool) any Sharepoint user who don't have manager except our CEO. The Javescript I referred below is from the other topics and modified to achieve the result. It filtering out the users without manager successfully .
However, I get this error message below when I go to the CEO department ; and the root UserName is our CEO's email. Thanks for your help!
// this user -CEO we need to ignore
var ignoreList = [
// this will have a value of true if it has manager data
var hasManager = (itemData["Manager"] !== '') ? true : false;
// this returns true if the given userName is not in the ignoreList array
// and the given user has manager data
return (ignoreList.indexOf(itemData['UserName']) < 0 && hasManager) ? true : false;