We are using “User Profiles” as data source.
We have a custom property named “MysiteManager”. We want OrgChart to use “MysiteManager” as the “Manager” field to build the OrgChart instead of default “Manager” field.
Currently the JS we are using as below:
var currentUserLogin = GetUrlKeyValue(“accountname”);
var isInitialLoad = true;
renderer.prerenderAction = function(completed) {
try {
var context = SP.ClientContext.get_current();
var web = context.get_web();
var user = web.get_currentUser();
context.load(user);
context.executeQueryAsync(function() {
if (currentUserLogin == "") {
currentUserLogin = user.get_loginName();
}
completed();
}, function(sender, args) {
completed();
});
} catch (e) {
completed();
}
}
renderer.onLoadingFinished(function() {
if (isInitialLoad) {
isInitialLoad = false;
renderer.dataProvider.getBoxGroupItemDataById(currentUserLogin, function(dataItem) {
var userToShowData = currentUserLogin;
if (dataItem.ParentId != "") userToShowData = dataItem.ParentId;
//this code controls who's data is show and how many levels to drilldown
renderer.drillDown(userToShowData, function() {
renderer.expandNodeLevels(2);
});
});
}
});
Note: This is resolved by changing if (dataItem.ParentId != “”) userToShowData = dataItem.ParentId; to if (dataItem.Properties.MysiteManager!= “”) userToShowData = dataItem.Properties.MysiteManager;