Drill Down to manager after opening search result


#1

Hey Guys,

what we want to achieve: If we search for persons who have no people under them in the hierarchy we want to drill down to their manager. This will show the team and not only one person. I saw the article for drilling down to the current users manager on initial load but I don’t get it working for this use case.

Is such behaviour possible?


#2

Hi @JoshMohr,

Please open the configuration wizard, navigate to the "Custom JavaScript tab and paste this script:

renderer.searchManager._searchResultClickedAction = function (itemId) {
    renderer.dataProvider.getBoxGroupItemDataById(itemId, function (item) {

        if (item.DirectReports.length === 0 && item.ParentId) {
            renderer.drillDown(item.ParentId);
        } else {
            renderer.drillDown(itemId);
        }

    })
}

Note: This script uses internal Org Chart parameter “_searchResultClickedAction”. Thus, I can’t guarantee that this will not break after some of the future org Chart updates.

Our paid support can expose this parameter to the public API. In this case, you may need to drop a message to [email protected].


#3

Hey @antonkhrit,

Thanks your script works like a charm! I guess it won’t be a huge problem if this will stop working :slight_smile:


#4

You are welcome @JoshMohr!