Canvas apps
In a canvas app (or a custom page in a model-driven app), the Org Chart shows your table and raises OnMove when someone gets a new manager; your formula does the saving.
The examples use the samples table Sample People, with the columns Name, Title, Department and Reports to (a lookup to Sample People). Its ID column is Sample Person. Replace the names with yours.
1. Allow code components
Once per environment, an admin turns on Allow publishing of canvas apps with code components. See Install.
2. Add the Org Chart
- Open your app in Power Apps Studio. Under Data, select Add data, then Sample People.
- Go to Insert, Get more components, then the Code tab. Tick Ninth Forge Org Chart and select Import.
- Go to Insert, Code components, then Ninth Forge Org Chart. Set its Width to
Parent.Widthand its Height toParent.Height.
3. Bind it with text IDs
Canvas apps can’t map a lookup column to a code component, so leave Reports to empty. Instead, give the chart each person’s ID and their manager’s ID as text, and list every column the chart shows:
ShowColumns(
AddColumns('Sample People',
RowId, Text(ThisRecord.'Sample Person'),
ManagerId, Text(ThisRecord.'Reports to'.'Sample Person')),
RowId, ManagerId, Name, Title, Department)ShowColumns matters: with a shaped Items, Power Apps only fetches the columns the formula names, so a column you map but don’t list arrives empty. Put the formula in Items, then set these on the Advanced tab, each column’s logical name in quotes:
| Property | Value |
|---|---|
nodeRecordKey (Record ID) |
"RowId" |
nodeParentKey (Manager ID) |
"ManagerId" |
nodeName (Name) |
"nf_name", your name column |
nodeTitle, nodeGroup |
"nf_title", "nf_department"; any other column works the same way once it is in ShowColumns |
AddColumns isn’t delegated, so the chart gets up to 500 rows by default (2,000 at most, under Settings, Data row limit). For a bigger table, Filter it first, for example to one department.
4. Save moves: OnMove
Each move sets Self.lastMove to JSON with the person’s id, their new parentId and the previousParentId, all real record IDs. Patch the record in OnMove:
With({ m: ParseJSON(Self.lastMove) },
Patch('Sample People',
LookUp('Sample People', 'Sample Person' = GUID(Text(m.id))),
{ 'Reports to': LookUp('Sample People', 'Sample Person' = GUID(Text(m.parentId))) }))Studio shows delegation warnings on this formula’s LookUps. They’re expected: each one finds a single row by its ID.
The chart shows the move at once and keeps it once the row changes. If the row doesn’t change within 10 seconds, the move is put back with a message.
5. Licence key
Moving people needs a Plan key. In canvas apps, add the Environment Variable Values table under Data, then set Licence key to:
LookUp(
'Environment Variable Values',
'Environment Variable Definition'.'Schema Name' = "nf_NinthForgeLicenceKeys"
).ValueDon’t paste the key itself into the app. Without a key the chart is Org Chart Lite: everything but moving people.
Custom pages
A custom page is a canvas page inside a model-driven app, so the steps are the same. Add the page to your app from the app designer (Add page, Custom page) and publish both the page and the app.
Last updated