Docs menu

Canvas setup

In a canvas app, Kanban Pro shows a Dataverse table and raises OnCardMove after each move; your formula saves it with Patch.

The example uses a table Board Items (ID column Board Item) with a Name, the Status Reason, a choice column Team for swimlanes, a currency column Value and a whole number column Sort order. Replace the names with yours.

1. Add Kanban Pro

  1. Open your canvas app in Power Apps Studio and add your table under Data.
  2. Go to Insert, Get more components (the box icon at the top of the Insert pane), the Code tab. Tick Ninth Forge Kanban Pro and select Import.
  3. Go to Insert, Code components, Ninth Forge Kanban Pro, and pick your table as its data source.
  4. Make it big, for example the screen’s width and height.

2. Add the columns under Fields

On the Display tab, next to Fields, select Edit and make sure the columns you use are there (Add field). The board takes each choice’s options, in order, from its entry under Fields.

3. Map the columns

On the Advanced tab, set these to the columns’ logical names, in quotes:

Property Value
cardTitle "cr123_name" (required)
cardStatus "statuscode", or a choice column such as "cr123_stage"
cardLane Optional: a choice column for swimlanes, such as "cr123_team"
cardSortOrder Optional: a whole number column, such as "cr123_sort"
cardValue Optional: a number or currency column for totals

Owner and multi-select tags can’t be bound in canvas apps. Use a text column for the owner’s name instead.

4. Save the move: OnCardMove

Each move sets two outputs, then raises OnCardMove:

  • Self.lastMove: { "id", "fromColumn", "toColumn", "toValue", "fromLane", "toLane", "toLaneValue", "toPosition" }. Column and lane names are the option labels.
  • Self.sortWritesJson: the cards whose sort order changed, as [{ "id", "order" }]. Usually just the moved card.

Set OnCardMove to:

With(
    { m: ParseJSON(Self.lastMove) },
    Patch(
        'Board Items',
        LookUp('Board Items', 'Board Item' = GUID(Text(m.id))),
        {
            Status: If(Text(m.toColumn) in ["Done", "Won't do"], 'Status (Board Items)'.Inactive, 'Status (Board Items)'.Active),
            'Status Reason': LookUp(Choices('Board Items'.'Status Reason'), Text(Value) = Text(m.toColumn)).Value,
            Team: LookUp(Choices('Board Items'.Team), Text(Value) = Text(m.toLane)).Value
        }
    )
);
ForAll(
    Table(ParseJSON(Self.sortWritesJson)) As w,
    Patch('Board Items', LookUp('Board Items', 'Board Item' = GUID(Text(w.Value.id))), { 'Sort order': Value(w.Value.order) })
)
  • Status must change with the status reason. Canvas apps don’t tell the board which reasons are Inactive, so list yours in the If. Without it, a move into Done fails with “not a valid status code for state code Active”, and the board puts the card back.
  • Leave out Team if you don’t use swimlanes, and Status if your columns are a plain choice.
  • Studio may show a delegation warning under the GUID(...) lookups. It’s safe: each finds one row by its ID.

5. Save quick edits: OnCardEdit

Quick edit (double-click a card, or select it and press E) sets Self.lastEdit to { "id", "field", "value", "label" }, then raises OnCardEdit. field is title for the name. The board shows the change and waits for your Patch to appear.

With(
    { e: ParseJSON(Self.lastEdit) },
    If(
        Text(e.field) = "title",
        Patch('Board Items', LookUp('Board Items', 'Board Item' = GUID(Text(e.id))), { Name: Text(e.value) })
    )
)

6. Open a record: OnCardOpen

Open record in quick edit sets Self.selectedIds to a JSON array with the card’s id, then raises OnCardOpen. For example, go to an edit screen with that record:

Navigate(
    EditScreen,
    ScreenTransition.None,
    { rec: LookUp('Board Items', 'Board Item' = GUID(Text(Index(Table(ParseJSON(Self.selectedIds)), 1).Value))) }
)

7. New cards: OnCreateRequest

+ in a column header sets Self.createRequest to { "column", "columnValue", "lane", "laneValue" }, then raises OnCreateRequest. lane is empty when + is in the column header rather than a lane. Open a form in new mode prefilled from it, or create the row straight away:

With(
    { r: ParseJSON(Self.createRequest) },
    Patch(
        'Board Items',
        Defaults('Board Items'),
        {
            Name: "New card",
            Team: LookUp(Choices('Board Items'.Team), Text(Value) = Text(r.lane)).Value
        }
    )
)

A new row starts in the table’s default status reason. To start it in the column you picked, also set ‘Status Reason’ as in OnCardMove (only for active reasons).

8. Your licence key

In model-driven apps the board reads your keys from the Ninth Forge licence keys environment variable. Canvas apps can’t, so set Licence key (Display tab) to a formula that reads the same variable. Add the Environment Variable Values table under Data first:

LookUp(
    'Environment Variable Values',
    'Environment Variable Definition'.'Schema Name' = "nf_NinthForgeLicenceKeys"
).Value

Don’t paste the key itself into the app. Without a key you can see everything and try it; editing and saving need a key. Start a free 30-day trial to unlock everything. Until then, a small “Ninth Forge · Unlicensed” link shows in the corner, and a move snaps back with “Saving changes needs a Ninth Forge Plan key”, without raising OnCardMove.

Things to know in canvas apps

  • Column order: status reasons appear in option order (New, Done, Ready…), because canvas apps don’t pass which reasons are Active. A choice column keeps its own order.
  • Colours: canvas apps don’t pass choice colours; set columnColors, for example "New=#8A8F98; Ready=#2E54FF; Done=#138A52".
  • Undo: in Studio’s Play mode, Ctrl+Z goes to Studio, so use the Undo button on the bar.

Check it

In Play mode, move a card to another column, then to another lane, and check the table: the status reason, the Team and usually one Sort order changed. Move one into Done: its Status is now Inactive.

Last updated