Add a button (declarative)
ribbon_add_buttonAdd a button with its command, labels, and display/enable rules to a Dynamics 365 ribbon in a single declarative call, generating schema-correct XML.
Instructions
Add a button with its command, rules and labels to the local working copy in one declarative call. The server generates schema-correct XML with proper id conventions, $LocLabels:/$webresource: prefixes and element order. Requires ribbon_checkout first. Get the location from ribbon_get_structure (a group id + '.Controls._children').
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| id | Yes | Unique button id, convention: <publisherprefix>.<entity>.<Name>.Button, e.g. new_.account.Approve.Button | |
| label | Yes | Button label (LCID 1033) | |
| action | No | What the command does when the button is clicked. | |
| entity | Yes | Entity logical name (e.g. 'account'), or 'APPLICATION' for the application ribbon. Note: APPLICATION support is EXPERIMENTAL (implemented per documented schema but not yet covered by the live end-to-end test suite) — take extra care and keep the backup ids at hand. | |
| command | No | Reuse an EXISTING command id instead of creating one (omit 'action' when set) | |
| image16 | No | Web resource name for 16x16 icon (classic) | |
| image32 | No | Web resource name for 32x32 icon (classic) | |
| tooltip | No | ||
| location | Yes | CustomAction Location, e.g. 'Mscrm.Form.account.MainTab.Save.Controls._children' to append into a group | |
| sequence | No | Position among siblings; OOTB controls are spaced by 10. Default 100. | |
| enableRules | No | ||
| environment | No | Dataverse environment URL, e.g. https://myorg.crm4.dynamics.com. Optional when the RIBBON_MCP_ENV_URL environment variable is set. | |
| modernImage | No | Unified Interface icon name (e.g. 'Add') or SVG web resource | |
| displayRules | No | ||
| templateAlias | No | Layout slot of the target group (see group.template in ribbon_get_structure). Default 'o1'. | |
| labelTranslations | No | Extra label translations: { '1031': 'Genehmigen' } | |
| tooltipDescription | No |