# Building Cue Rolecenters

> Builds Cue tiles and Activities CardPart pages for Business Central Role Centers, creates FlowField tables with CalcFormula counts, and implements drill-down navigation. Use when adding KPI dashboards, displaying record statistics, creating status indicators, or extending existing Role Centers with custom activity tiles.

- **Type:** Skill
- **Install:** `agentstack add skill-emgreppi-business-central-ai-skill-building-cue-rolecenters`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [emgreppi](https://agentstack.voostack.com/s/emgreppi)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [emgreppi](https://github.com/emgreppi)
- **Source:** https://github.com/emgreppi/Business-Central-AI-Skill/tree/main/building-cue-rolecenters

## Install

```sh
agentstack add skill-emgreppi-business-central-ai-skill-building-cue-rolecenters
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# Skill: AL Cue and Role Center Activities

## Validation Gates

1. **After Step 1**: Cue table compiles, FlowFields calculate correct counts
2. **After Step 2**: Activities page displays tiles, OnDrillDown navigates correctly
3. **Final**: Page extension adds part to Role Center, styles render as expected

**Prerequisites:** Identify source tables, filter criteria, and target Role Center (e.g., Order Processor 9006, Accountant 9027).

**Architecture:** Role Center Page → Activities CardPart (CueGroups) → Cue Table (FlowFields with CalcFormula counts)

## Procedure

### Step 1: Create Cue Table

The Cue Table contains **FlowFields** that calculate counts from source records.

**Key patterns:**
- Single Primary Key field (Code[10])
- FlowFields with `CalcFormula = count(...)`
- Editable = false on all FlowFields
- FieldClass = FlowField

```al
table  "  Cue"
{
    Caption = ' Cue';
    DataClassification = CustomerContent;

    fields
    {
        field(1; "Primary Key"; Code[10])
        {
            Caption = 'Primary Key';
            DataClassification = SystemMetadata;
        }

        field(10; " "; Integer)
        {
            CalcFormula = count("" where(
                "" = const(),
                "" = const()));
            Caption = ' ';
            ToolTip = 'Number of  with status ';
            Editable = false;
            FieldClass = FlowField;
        }

        field(20; " "; Integer)
        {
            CalcFormula = count("" where(
                "" = const(),
                "" = const()));
            Caption = ' ';
            ToolTip = 'Number of  with status ';
            Editable = false;
            FieldClass = FlowField;
        }
        // Add more cue fields as needed...
    }

    keys
    {
        key(PK; "Primary Key")
        {
            Clustered = true;
        }
    }
}
```

### Step 2: Create Activities Page (CardPart)

The Activities page displays the cue tiles and handles drill-down navigation.

**Key patterns:**
- PageType = CardPart
- RefreshOnActivate = true (updates counts when user returns to RC)
- CueGroup for tile grouping
- OnDrillDown triggers for navigation
- Style property for visual emphasis

```al
page  "  Activities"
{
    Caption = '';
    PageType = CardPart;
    RefreshOnActivate = true;
    SourceTable = "  Cue";

    layout
    {
        area(content)
        {
            cuegroup()
            {
                Caption = '';

                field(""; Rec."")
                {
                    ApplicationArea = All;
                    DrillDownPageID = "";
                    ToolTip = '';

                    trigger OnDrillDown()
                    var
                        SourceRec: Record "";
                    begin
                        SourceRec.SetRange("", );
                        SourceRec.SetRange("", );
                        Page.Run(Page::"", SourceRec);
                    end;
                }

                field(""; Rec."")
                {
                    ApplicationArea = All;
                    DrillDownPageID = "";
                    ToolTip = '';
                    Style = Attention;  // Yellow highlight

                    trigger OnDrillDown()
                    // ... similar pattern
                }

                field(""; Rec."")
                {
                    ApplicationArea = All;
                    Style = Favorable;  // Green highlight
                    // ...
                }
            }
        }
    }

    trigger OnOpenPage()
    begin
        Rec.Reset();
        if not Rec.Get() then begin
            Rec.Init();
            Rec.Insert();
        end;
    end;
}
```

### Step 3: Extend Role Center

Add your Activities page to an existing Role Center.

**Key patterns:**
- Find the correct anchor control (use F12 to explore Base App RC)
- Use `addafter` or `addbefore` for positioning
- Add actions to Sections and/or Creation areas

```al
pageextension  "  Ext" extends ""
{
    layout
    {
        addafter()
        {
            part("  Activities"; "  Activities")
            {
                ApplicationArea = All;
                Caption = '';
            }
        }
    }

    actions
    {
        addlast(Sections)
        {
            group(Section)
            {
                Caption = '';
                Image = Setup;

                action()
                {
                    Caption = '';
                    ApplicationArea = All;
                    ToolTip = '';
                    RunObject = Page "";
                }
            }
        }
    }
}
```

## Quick Reference

**Cue Styles:** `Attention` (yellow), `Favorable` (green), `Unfavorable` (red), `Subordinate` (gray), `Ambiguous` (orange)

**Common Role Centers:** Order Processor (9006), Accountant (9027), Business Manager (9022), Sales Manager (9005), Purchasing Agent (9007)

**Best Practices:** Efficient CalcFormula filters • OnDrillDown must match CalcFormula filters • Single record table (Primary Key = '') • RefreshOnActivate = true

## References

See `references/` folder for:
- `cue-patterns.md` - Complete code examples

## External Documentation

- [Microsoft: Cues and Action Tiles](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-cues-action-tiles)
- [Microsoft: Role Center Design](https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/devenv-designing-role-centers)

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [emgreppi](https://github.com/emgreppi)
- **Source:** [emgreppi/Business-Central-AI-Skill](https://github.com/emgreppi/Business-Central-AI-Skill)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-emgreppi-business-central-ai-skill-building-cue-rolecenters
- Seller: https://agentstack.voostack.com/s/emgreppi
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
