Elevating User Experience in Model-Driven Apps: Tips and Tricks for Optimal Engagement – Part 3

In part 3 of this series, we’re diving into a common need: the ability to quickly duplicate records within the system. Whether you’re managing accounts, contacts, or other entities, a “Copy Record” button can save significant time and ensure data consistency. In this post, I’ll guide you through the steps to create a custom “Copy Record” button for accounts.

Step-by-Step Guide to Creating a Copy Record Button

Step 1: Access the Account’s View in Your App

Navigate to the account’s view within your Model-Driven App.

A screenshot of a computer

Description automatically generated

Step 2: Edit the Command Bar

Select the “Edit” command bar on the Account view.

A screenshot of a computer

Description automatically generated

Step 3: Edit the Main Grid

Choose to edit the Main grid.

A screenshot of a computer

Description automatically generated

Step 4: Create a New Command

Go to the “Create New” command option.

A screenshot of a computer

Description automatically generated

Step 5: Customize the New Command

Once the new command appears, rename it and choose an appropriate icon.

A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated

Step 6: Write the OnSelect Action Formula

In the function editor, enter this function:

ForAll(Self.Selected.AllItems,Patch(Accounts,Defaults(Accounts),{‘Account Name’:”Cloned “&ThisRecord.’Account Name’}));

A screenshot of a computer

Description automatically generated

This function patches the selected account records, creating duplicates with a new account name. To modify additional fields, include them within the {} brackets.

Additionally, to display a notification showing the number of records copied, use this function:

Notify(“Copied “&CountRows(Self.Selected.AllItems)&” Records.”);

A screen shot of a computer

Description automatically generated

Step 7: Set Button Visibility

Ensure the button only appears when one or more records are selected by setting this function in the Visibility field:

If(CountRows(Self.Selected.AllItems)>0,true,false)

A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated

Step 8: Publish Customizations

Save and publish your customizations.

Testing Your New Copy Record Button

Navigate to an account record in your app. Once you select the records, the new “Copy Record” button should be visible. Upon pressing the button, the selected records will be duplicated, and a notification will confirm how many records were copied.

A screenshot of a computer

Description automatically generated
A screenshot of a computer

Description automatically generated

By following these steps, you can streamline data entry and management in your app, making it easier to handle repetitive tasks efficiently. The “Copy Record” button not only saves time but also helps maintain consistency across records.

Remember, while this example focuses on the Account entity, you can adapt the script and steps for other entities within Dynamics 365 as needed. Happy customizing!


Welcome to our new site!

Here you will find a wealth of information created for people  that are on a mission to redefine business models with cloud techinologies, AI, automation, low code / no code applications, data, security & more to compete in the Acceleration Economy!