command-bar-buttons
Skill8 starsChanged 41 days agoMITView on GitHub
Add, change or remove a button on a Dataverse / Dynamics 365 table command bar — classic RibbonDiffXml (ribbon_get, ribbon_add_button, ribbon_remove_button) or modern commands in the appaction table (command_*). Covers which mechanism to pick, how the ribbon is really stored, the failures that return success while the button silently never appears, and a deployed button change that never reaches the users (ribbon_diagnose, ribbon_sync_unmanaged_layer, ribbon_refresh_client_metadata). Use when the user wants a button, ribbon or command bar entry on a table, form or grid, when a button they added is missing, mislabelled or vanishes on row selection, or when users still get the old behaviour after a deployment.
In this repository7 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- business-process-flowsSkill
- classic-workflowsSkill
- cloud-flowsSkill
- form-authoringSkill
- modeling-patternsSkill
- solution-pipelinesSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 99
Never let one stand in for the other.
- Distinctive: line 102
Read the whole command bar: Do not filter for the caption you expect — a mislabelled button is exactly the case you would then miss.
- Distinctive: line 111
Search for the button id and the caption.
≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Buttons on a Dataverse command bar
Two mechanisms exist and picking the wrong one costs a day. Full reference, all of it verified
against a live org: ${CLAUDE_PLUGIN_ROOT}/docs/tools/buttons-classic-vs-modern.md. Read it before
the first write — the summary below is a router, not a substitute.
Pick the mechanism first
Does visibility depend on what is selected in a grid?
- Yes → classic ribbon.
SelectionCountRuleis entity-bound and self-contained. Tools:ribbon_get,ribbon_add_button,ribbon_remove_button. One limit to plan around: aMinimumabove 1 is not enforced — the button is enabled on a single selected row too, so the lower bound has to be re-checked in the handler and server-side. - No → either works. Modern commands are Microsoft's direction; classic stays versionable as XML.
The modern equivalent of a selection rule is a Power Fx formula, and that formula must live in a canvas component library. No API can create one — only the Command Designer opened from an app, which turns a table-level button into an app dependency that has to be dragged through every environment. That is the whole argument for classic here, and it is on merit, not nostalgia.
Classic ribbons still render. An appactionmigration row with ismigrated = True does not mean
classic RibbonDiffXml is ignored. Both mechanisms render side by side on the same table.
Before you write
- There is no Web API that writes a ribbon.
ribbon_add_buttondoes a solution round-trip internally. Do not hand-roll it — steps 4, 5 and 8 of that round-trip are load-bearing in non-obvious ways. - A non-empty
<CustomActions>import replaces the entire collection. An import naming only your new button deletes every other one.ribbon_add_buttonre-sends the existing nodes and reportslostCustomActionIds; a hand-built import has no such guard. - An empty
<CustomActions />removes nothing. Deletion goes throughribbon_remove_button, which deletes the storedribbondiff/ribboncommand/ribbonrulerows. ribbondiffholds more than CustomActions. Localized captions live there too, as<LocLabel>nodes withdifftype = 3, and they belong in<LocLabels>— not in<CustomActions>, where the importer rejects them with "Missing Location Attribute … for CustomAction element with Id=….LabelText".ribbon_getreturns them separately (customActions/locLabels/otherDiffs), andribbon_remove_buttondeletes a button's label rows with it — an orphaned one breaks the next add on that table. Any table that has seen the Ribbon Workbench has such rows.
Failures that return success
Each of these logs nothing and leaves you with a missing or wrong button. Check them first when something does not appear:
- Invalid
fontIcon(e.g.$clientsvg:Money) — modern command never renders.command_createvalidates;command_list_iconsprints the known-good set. - A caption the client cannot resolve — and a literal
LabelTextis one: it is stored and read back perfectly, and the Unified Interface draws no button at all. A$LocLabels:reference without its<LocLabel>node renders the raw token instead. The configuration that works is a<LocLabel>node plus a reference, which is whatribbon_add_buttonnow writes — pass the caption aslabel. WatchcaptionLanguageCodein the result: a caption under a language the org does not use is just as invisible as no caption. It defaults to the language the table's other buttons use. — this was in the list and is wrong. Six buttons onModernImage="$webresource:….svg"invoicecarry such a reference and all of them render; the disappearance came from the caption (point 2). The rejection has been removed from the tool.- A
Locationthat does not exist — nothing renders.ribbon_getwithincludeLocations=truelists the valid ones. - Grid modern command with
visibilitytype = 0— vanishes as soon as rows are selected. The most common "my button disappeared" report. - Wrong app. Custom commands do not render in
d365default. Check in a real app. - An unmanaged ribbon layer on the target overrides the deployment. Every managed import of the
command is stored and never takes effect. It cannot be removed —
RemoveActiveCustomizationsrefuses ribbons (0x8004f059) — only overwritten withribbon_sync_unmanaged_layer. - The client keeps receiving the old command. Database and compiled ribbon are right; publishing
the ribbon, the table, the app or everything does not rebuild what
GetClientMetadataserves. A change to the table's own metadata does:ribbon_refresh_client_metadata.
Users still get the old behaviour after a deployment
Go through the levels in this order and stop at the first that is wrong. ribbon_diagnose does all
three and names the failing level:
- Stored — does an unmanaged (
Active) layer differ from every managed copy? →ribbon_sync_unmanaged_layerwithsourceSolution= the managed solution that holds the intended version. Run it with the defaultdryRun=truefirst and read the plan. - Compiled — does
RetrieveEntityRibbonshow the stored version? → publish the table. - Delivered — does each app's client receive the compiled version?
→
ribbon_refresh_client_metadata, then have the users reload.
Never edit a ribbon directly on a staging or production environment (Ribbon Workbench, a manual
import). That is how the unmanaged layers in point 1 come about, and they cannot be taken back. Before
and after deploying a ribbon change to such an environment, run ribbon_scan_unmanaged_layers there:
any command under commandsOverridingManaged will ignore the deployment.
solution_remove_active_layer is for other components. On a table it removes the table's unmanaged
properties, but not its unmanaged ribbon.
Verifying — the part that actually costs the time
Separate stored from drawn. ribbon_get answers the first; only a browser answers the second.
Never let one stand in for the other. In between sits delivered — what the server hands the
client — which ribbon_diagnose reads per app, so a stale server cache shows up without a browser.
- Read the whole command bar. Do not filter for the caption you expect — a mislabelled button is
exactly the case you would then miss. This once produced the conclusion that classic ribbons no
longer worked at all, when the button had been rendering the whole time as
LabelText. - Compare against a reference button you know works — on the same table. If yours is missing and
the reference renders, the fault is in your definition. If neither renders, you are in the wrong app.
The table matters: comparing an
invoicebutton againstsample_purchaseorder, where literal captions work fine, sends you through Location, TemplateAlias, Sequence and cache while the cause is the label. - Searching the compiled ribbon for your CustomAction id always fails.
RetrieveEntityRibbonreturns the ribbon with the diff already applied — it contains no<CustomAction>elements at all. Search for the button id and the caption.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

