Adding, changing and removing a button
In short
The assistant does not create the button itself. It leads you with a link to the right place in the command designer of Power Apps and provides every value to copy; you do the steps there yourself. This page describes them: 13 to 20 steps when creating, depending on what you chose in the assistant, and four when changing and removing. Most of them come with a short recording from Power Apps. Which questions the assistant asks beforehand is described under Buttons: the assistant, and what the finished button does on click under What happens on click.
The process at a glance
For these steps you need the right to edit the app in which the button is to appear (see Rights and roles: Adding a button). The template must be saved. What an administrator otherwise has to prepare is described under Preparing buttons and flows.
- At the top of the designer, click “🖨 Manage buttons in Dynamics”. Choose the app, the table and the place of the button, for example the main form or the list, whether it applies to one row or to all checked rows, and what it should do: show the document, email draft, send email immediately or, for a template with a switched-on e-invoice, download the e-invoice. For the two email purposes you also choose who the email goes to. Each of these questions is explained in Buttons: the assistant: The steps at a glance.
- The designer shows instructions with all values to copy and a link. The link opens the command designer at the right place (see The instructions in the command designer).
- Create a new command there, give it a label and enter the values from the instructions (see The steps for creating a button).
- In the command designer, click “Save and Publish” and then reload the app with Ctrl + F5. Even then it can take a few minutes until the button appears, because Dynamics caches the command bar.
When changing and removing, the assistant only asks which button is meant; the steps for that are under Changing or removing a button.
Good to know
Whether a button applies to one or to all checked rows is chosen in the assistant (see Buttons: the assistant: Does it matter what the user checks?). How many rows a button processes at once is described under What happens on click: Several checked rows. Where “Send email immediately” gets the recipient from is described in Buttons: the assistant: Who receives the email?
The instructions in the command designer
The instructions are the last step of all branches, “Step by step”. The explanatory text says: From here on it is about Power Apps, where the button is created. The images show the command designer; the pink frame encloses what you have to click each time. When changing, it says “changed” instead of “created”, and when removing, “removed”.
- 1The orange box: The assistant does not create the button; you do that yourself in Power Apps.
- 2The blue button opens the command designer in a new tab at exactly the right place.
- 3The copy line “… or the link” with the button “Copy”: the same link to copy, in case the browser blocks the new tab.
- 4The first card “1 · Open the command designer”: The steps are listed one below the other as numbered cards.
The head: notice, link and copy line
| Element | What it does |
|---|---|
| Orange box in large type | When creating: “You create the button yourself.” Below it: Everything is ready here, the link to exactly the right place and every value to copy, each at the step where you have to type it in. When changing and removing: “Changes and removals are made in the same place where buttons are created.” With a link, this follows: The link below takes you to the place where this button is located. Without a link: This button applies in every app, so no link to a specific place can be built; open Power Apps by hand and look for the table there. |
| “▸ Open the command designer at this location” | Highlighted button across the full width. It opens the command designer of Power Apps in a new tab at exactly the right place: environment, default solution, table, app and place. This can take a while, because Power Apps loads the whole app. When changing and removing, table, app and place come from the chosen button. The button appears only if a link can be built, that is, if environment, table and app are known; otherwise an orange box appears: For this button the link cannot be built, it is bound to no app and thus applies in every one; open Power Apps by hand and look for the table there. |
| Copy line “… or the link” | Note: “In case the button above is blocked.” It appears only together with the button and contains the same link to copy, in case the browser blocks the new tab. |
The steps for creating a button
Each step appears as a card with the heading “Number · Title”, for example “1 · Open the command designer”. After many titles, the name as Dynamics shows it follows after a dash, for example “9 · Enter the function — »Function name«”; the table gives the titles without this addition. The numbers count on continuously; the steps for the third parameter, saving the template, the path, the recipient, the flow and the visibility have no fixed number. Cards 1 to 11 always appear; after them come the cards needed depending on your choices, and at the end “Save and Publish” and “Try it out once”. Each card contains the text with paragraphs, if applicable a copy line (above the image, because the image shows only a single case), the image and, if applicable, a closing note with an orange border.
| Step | What you do in the command designer | Value to copy |
|---|---|---|
| “1 · Open the command designer” | Press the blue button at the top. It takes you directly to the command bar of the chosen table in the chosen app, at the chosen place. It may take a moment. | – |
| “2 · Create a new command” | At the top left, click “+ New” (“+ New”) and then “Command” (“Command”). A window with the properties opens on the right; you enter everything else there. | – |
| “3 · Click the new command and move it into place” | The new command is first called “NewCommand” and usually sits next to the one selected before. Click it once: it gets a colored frame, and everything that follows applies to it. Then drag it with the mouse button held down to the desired place. The order in the bar is what the users will see later; whatever no longer fits, Dynamics hides behind “⋯”. | – |
| “4 · Enter the »Label«” | At the very top right is “Label” (“Label”), the text on the button. As you type, the name in the bar changes immediately. If nothing changes there, you selected the wrong command. | “Suggestion”: “Show document”, “Send by email”, “Send immediately by email” or “Download e-invoice”, depending on the purpose. Note: Just a suggestion, feel free to write your own text here. |
| “5 · Give it an »Icon« (optional)” | Under the label, set “Icon” (“Icon”) to “Use Icon” (“Use Icon”) and look in the field below it for a suitable one, for a document for example “PDF”, for “Download e-invoice” better “Download”. Without an icon the button works just as well; it merely looks plainer in the bar. | – |
| “6 · Choose »Run JavaScript« as the action” | In the list “Action” (“Action”), choose “Run JavaScript” (“Run JavaScript”), not “Run formula” (“Run formula”); that is something different. | – |
| “7 · Check whether the »Library« is already there” | Open the field “Library” (“Library”). If st_button.js is listed there, select it and skip the next step. It is always like this if a Smart Templates button has already been built on this bar. |
“Library”: st_button.js. Note: Write it exactly like this, with .js at the end. |
| “8 · Add the library — »Add library«” (only if it was not in the list in the previous step) | Click “Add library” (“Add library”), type the name into the search box of the window, click the hit and accept it with “Add” (“Add”). If you do not find it there, it is usually already attached: the window shows only what has not been added yet. Then go back one step and look for it in the list. | “Library”: st_button.js. Note: Into the search box of the window. |
| “9 · Enter the function — »Function name«” | The field “Function” (“Function name”) takes the name that fits the chosen purpose. If it ends in All because you chose “all checked rows”, it is the same operation in a loop; what applies without All is described under What happens on click: The eight entries for the field “Function”. |
“Function”: one of the eight names from the table under What happens on click: The eight entries for the field “Function”; for the purpose “Download e-invoice” SmartTemplates.Button.downloadEInvoice, for “all checked rows” SmartTemplates.Button.downloadEInvoiceAll. Note: Exactly like this, with the dots. |
| 10 · Add the first parameter | Click “Add parameter” (“Add parameter”) and choose PrimaryControl in the type list; in the subgrid view and the associated view, choose SelectedControl instead (there, PrimaryControl is the form on which the list sits, and the button would work for that one record instead of for the checked rows). Do not look for the entry in the text field: it is an entry of its own in the list, not a string that you type. This parameter must come first; through it the button learns on which record, or for which rows, it was pressed. At the two list places, a closing note appears under the image: if the image shows PrimaryControl, it comes from a button on the form; here you choose SelectedControl in the same list. |
– |
| 11 · Add the second parameter | “Add parameter” once more, this time as type “String” (“String”). In the field below it goes the identifier of this template. | “Parameter 2”: the identifier of the template. Note: The ID of the template “Name”. |
| “Add the third parameter” (only for an email purpose with “Always the same template” and a chosen email template) | “Add parameter” a third time, again as “String”. This is the email template that supplies the subject, the text and its attachments. | “Parameter 3”: the identifier of the email template. Note: The email template “Name”. |
| “Save the template — otherwise the button does not know the cases” (only for an email purpose with “Depending on a condition”; no image) | The if-then cases belong to the template, not to the button. Save them at the top of the designer with “Save” before you try out the button. The button deliberately gets no parameter for the email template in this case; it asks for the cases on click. | – |
| “Add the path as the last parameter” (only if the button sits on a different table than the primary source) | “Add parameter” once more, again as “String”. This is the path from the table of the button to the primary source; without it the button would not know which record to print. It must come after the template and the email template; only parameters with flow: or to: in front of them may come after it. |
“Parameter 3” or “Parameter 4” (4 if the third is the email template): the path text. Note: On the left the lookup field, on the right the table behind it; several levels separated by a comma. |
| “Add the recipient as a parameter” (only for an email purpose, if you chose a lookup or an email field in the step “Who receives the email?”) | “Add parameter” once more, again as “String”. With it, the button passes the recipient from the record on click. The to: at the beginning belongs to it and must not be dropped: it is how the button recognizes that this is the recipient and not the path. With the prefix, the order does not matter either. For “Send email immediately”, a note follows below: if the field is empty on a record, the button sends nothing for it and says so. |
“Parameter 3” to “Parameter 5”: to:_field_value for a lookup, for example to:_customerid_value; to:field for an email field, for example to:emailaddress1. Note: Exactly like this, with to: in front. |
| “Add the flow as a parameter” (only with “Yes, start this flow” and a chosen flow) | “Add parameter” once more, again as “String”. With it, the button knows which flow to start. The flow: at the beginning belongs to it and must not be dropped: it is how the button recognizes that this is a flow identifier and not a template, which otherwise looks the same. With the prefix, the order does not matter either. For “all checked rows”, a note follows below: the flow runs per record, four checked rows result in four flow runs. |
“Parameter 3” to “Parameter 6”: flow:identifier. Note: Exactly like this, with flow: in front. |
| “Switch »Visibility« to a formula” (only at the three list places, also for “Exactly one record”) | The button should appear only if the user has checked anything at all. The command designer can do this itself. On the right, under “Visibility” (“Visibility”), is “Show” (“Show”); open the field and choose the second entry, “Show on condition from formula”. | – |
| “Confirm the prompt about the component library” (like the previous step) | The first time in the app, “Create a component library” appears; click “Continue”. This takes a moment, almost a minute in the recording: do not cancel. After that, the field says “Show on condition from formula”, and the formula bar appears at the top. This happens once per app. | – |
| “Enter the formula” (like the previous step) | The formula bar says “true”. Select that and replace it with the line. For “all checked rows”, the button appears as soon as at least one row is checked; for “Exactly one record” only if exactly one is checked, with two it stays hidden. If the top says “Create component library to enable Power Fx”, that is not an error: it is the prompt from the previous step, which is still pending. | “Formula (Power Fx)”: CountRows(Self.Selected.AllItems) > 0 for “all checked rows”, CountRows(Self.Selected.AllItems) = 1 for “exactly one record”. Note: Into the formula bar at the very top, not into a field on the right. |
| “Save the template — otherwise the button does not know the e-invoice” (only for the purpose “Download e-invoice” and only if the template has unsaved changes; no image) | On click, the button reads the saved template. If you switched on the e-invoice only in the open designer and have not saved yet, every click cancels, because it is not yet switched on there. Save the template at the top of the designer with “Save” before you try out the button. | – |
| “Save and Publish” | At the top right, “Save and Publish” (“Save and Publish”). After that, “Saving and publishing in progress …” appears for a while. It can take minutes until the button shows up in the app, because the command bar is cached in the browser. Reload the app; if it is still not there, wait a moment and reload once more. It is not lost. | – |
| “Try it out once” (no image) | First clear the cache: in the Dynamics app, press Ctrl+F5. Then open a record of the chosen table and press the button. If something goes wrong, it says so in plain words in a window (see What happens on click: When the button cancels). At the list places, check the rows instead for which something is to be created. For the purpose “Download e-invoice”, the e-invoice comes as a download, not in a new tab: the browser shows it in its download list, with several rows as a ZIP file. | – |
Good to know
The recordings show example values. What is valid is always what the assistant offers to copy. Whether the visibility formula really takes effect on a subgrid and in the associated view has not been measured; try it out there. On an older command it was observed that the field “Visibility” was missing; whether a new command has it in every app has not been checked. If it is missing, leave the formula out: the button then always appears, and with a wrong selection it reports that on click (see What happens on click: When the button cancels).
The images for the steps
Most steps show an animated screen recording from Power Apps that plays by itself. Below it says that the values in it come from an example and that what is valid is what is offered for copying above. If a recording does not load, a drawing of the command designer with a pink frame replaces the image, together with this line. Without an image are the steps “Open the command designer”, “Save the template — otherwise the button does not know the cases” (or “… the e-invoice”) and “Try it out once”. The images cannot be enlarged here, unlike in the instructions for the connection under Flows: The windows “Create a connection” and “First the connection — here is how”. For some steps, for example the third parameter, the path, the recipient and the flow, the replacement drawings highlight the same field “Parameter 2”; that does not fit there, and the text next to it applies.
- 1The field under “Action”: the action “Run JavaScript”, not a formula.
- 2The field under “Library”: the library of the button, here “st_button.js”.
- 3The text field with the function name (“SmartTemplates.Button.showDocu…”); the eight possible names are under What happens on click: The eight entries for the field “Function”.
- 4“Parameter 1” with “PrimaryControl”: The first parameter is a type, not a text; in the subgrid view and the associated view it is “SelectedControl”.
- 5“Parameter 2” with the type “String” and the text field below it: The second parameter is the identifier of the template.
Changing or removing a button
In the first step, choose “Change an existing button” or “Remove a button”. The assistant then searches all commands that point to Smart Templates and guides you through the command designer in four steps.
Which button do you want to change? / remove?
| Element | What it does |
|---|---|
| Heading with explanatory text | “Which button do you want to change?” or “Which button do you want to remove?” Explanatory text: “We searched for commands that point to Smart Templates.” All commands whose entry in the field “Function” contains “SmartTemplates” are listed. Commands without “SmartTemplates” in the function name do not appear. The assistant reads at most 400 commands; it says nothing about anything beyond that. |
| Button cards | One card per command. The title is the label of the command, or else its name. Below it says “Table or (without table) · Place or ? · App name or applies in every app”. A classic command belongs to no app and applies in every app that contains the table. The sorting is first by table (commands without a table last), then by label. The card shows the place in the interface language. App, table and place of the chosen command determine the link in the instructions; for a command without an app, no link can be built. |
| Orange box “No button was found that points to Smart Templates.” | It continues, in substance: Presumably there is none yet; then “Create a button” is the right way. “Continue ▸” stays disabled (“Please choose a button.”). |
The four steps
| Step | What you do | Value to copy |
|---|---|---|
| “1 · Open the command designer” (no image) | The text says: The button above takes you to the place where the chosen button sits on its table and at its place. This is true only if a link can be built; for a command without an app there is no button (see The head), and you look for the table in Power Apps by hand. | – |
| “2 · Find the button in the bar” | On the left, all commands of this bar are listed one below the other. Click the one you are looking for; its properties open on the right. | – |
| “3 · Change what is needed” (only when changing) | On the right you can adjust the label, the icon and the parameters. If you want to print a different template, it is the second parameter. | “This template”: the identifier of the open template. Note: In case you want to switch to it. |
| “3 · Remove” (only when removing) | At the top of the bar, click “Delete” (“Delete”). A prompt appears (“Delete command” — Are you sure you want to delete this command?); confirm it with “Ok”. This removes the command from the solution. The template in Smart Templates is not affected; only the button is gone. | – |
| “4 · Save and Publish” | At the top right, “Save and Publish” (“Save and Publish”); otherwise everything stays as it was. | – |
If an existing email button is to pass a recipient from the record in the future, go through the branch “Create a button” in the assistant up to the instructions: same table, same purpose, your choice in the step “Who receives the email?” (see Buttons: the assistant: Who receives the email?). From the step “Add the recipient as a parameter” there, copy the value to:… and append it to the existing command in step 3 with “Add parameter” as a further “String”.
If an existing button should also start a flow, copy the value flow:… with “⧉ ID” in the window “Manage flows” (see Flows: The list) and append it in step 3 with “Add parameter” as a further “String”.
The labels in the command designer come from Microsoft and were read off in September 2026; they may change. If the screen differs from the text, follow what you see there.
What changes in the document?
On the canvas
Nothing. What you create, change or remove in the command designer does not touch the sheet.
In the PDF
Nothing. The command designer belongs to Power Apps and does not change the template; even when a button is removed, the template in Smart Templates is untouched. What the finished button prints is described under What happens on click.