Displaying field from a list on the org chart

Hi,

I am looking to add a position number to my org chart.

We are currently using User Profiles as our data source, which does not have position number.

We have a SharePoint list on the same site that does have this information, with employee ID as a column and the field I am trying to use to match against.

I have tried to follow steps here (How to include and use fields from additional list for Org Chart in SharePoint and Microsoft Teams — Plumsail OrgChart 1.0 documentation) on how to do this can't get it to work.

Can someone please help?

Under Custom Java script I have added code on the tooltip rendered code:

api.onTooltipRendered((tooltip, itemData) => {
//Tooltip rendered event
// Trying to get the record from "All positions" list which has EmployeeID column
api.config.additionalList.listServerRelativeUrl = "/sites/Intranet/Lists/All%20positions";

api.config.additionalList.queryFunc = (itemData) => {
var EmployeesID = api.dataProvider._idResolver.trimUserProfileId(itemData["spsemployeeid"]);
return "(EmployeeID eq '" + EmployeesID + "')";
}

});

Then on the tooltip template code added another field:


Position ID: {{pochcontext.listdata.EmployeeID}}

When I click on someone, a new line appears with the "Position ID:" text, but no code.

Thanks for any help/direction

Hi @deb,

As I understand it, you put the code to get data from the additional list in the 'OnTooltipRendered' event - this is not quite correct, because the configuration is only loaded during Org Chart loading. Your code should look like this:

// Trying to get the record from "All positions" list which has EmployeeID column
api.config.additionalList.listServerRelativeUrl = "/sites/Intranet/Lists/All%20positions";

api.config.additionalList.queryFunc = (itemData) => {
   var EmployeesID = api.dataProvider._idResolver.trimUserProfileId(itemData["spsemployeeid"]);
   return "(EmployeeID eq '" + EmployeesID + "')";
}

api.onTooltipRendered((tooltip, itemData) => {
   //Tooltip rendered event
});

That should help fix the problem.