Go to Specific Node if Error

I have the below code in my custom Java section to drill to the an account name passed in the URL, if no account name exists, drill to the current user's manager. The problem is that I have a small set of the population that is filtered out using a filtration rule. If they try to load the org chart, they get an error that the rootID cannot be found (which makes sense because they are filtered out of the chart). How can I add a third "Failure" clause that states that if there is no name passed in the url, and the current user cannot be found, display a specific username as the rootID? Any help would be much appreciated.

//Drill Down to Manager Function

var accountNameFromUrl = GetUrlKeyValue("accountname");

function drillDownToManagerOfUser(accountName){

renderer.dataProvider.getBoxGroupItemDataById(accountName, 
    function (dataItem) {

    if (dataItem.ParentId) {
        console.log("Drilling down to manager: " + dataItem.ParentId);
        renderer.drillDown(dataItem.ParentId);
    } else {
        console.log("Drilling down to user: " + accountName);
        renderer.drillDown(accountName);
    }

});

}

//Don't wait for loading of initial root employee
renderer.config.renderInitialNode = false;

//Wait for web part loading
renderer.onInitialLoadingFinished(function () {

//if there is accountNameFromUrl in URL
if (!accountNameFromUrl) {
    
//Drill down to current user's manager if exists
    renderer.dataProvider.getCurrentUserAccountName(function (accountName) {            
        drillDownToManagerOfUser(accountName)
    })

} else {

    //Drill down to a manager of a user from URL if exists
    drillDownToManagerOfUser(accountNameFromUrl)

}

})

Hello @woverla,

Thank you for your question. We are working on it. I will be back with updates on Monday.

Best Regards,
Anna Dorokhova
Plumsail Team

Anna, have you been able to give this problem any thought? Any update?

Im still struggling with this issue. I have tried a few options but it is still not working. Any ideas on a solution?