Model-Driven Apps: Modern Command Bar Customization

Model-Driven Apps: Modern Command Bar Customization
SOURCE: Credit to Scott Durow

Link:  https://youtu.be/Jq2GLgNEcp0?si=K4xodRYmI_fvjNVd

Summary of Topics:

✨How to clone a record including child records Note: Instead of editing the fx formula directly, select ... Edit next to Table Name, Edit Command Bar Form and +New Command called 'Clone' and give it the Clone icon.

OnSelect FX formula can be edited easily via the Component Library (similar to Canvas App experience). The trick is to use the With syntax to also clone the child records for the Purchase order line item in this example!

1) Create a Clone Button:


2) Action: Run formula (fx open formula bar), Save and Publish
3) Open component library and edit your fx formula their (easier) and similar to canvas app designer
4) First, We can make the formula just copy the Parent record, then enhance it for child records later


This will make a copy of the entire parent record. Optionally you can select just certain fields.

or Below you can modify the formula to also copy the child records ie line items by using: With



✨How to control the visibility of a button depending on the state of a form

Show on condition. ie only show the clone button on existing records: Edit Visibility below Action to say:

Show on condition from formula Visible = fx Self.Selected.State <> FormMode.New












Add a tooltip on clone button for V1.1 or whatever.

Also, when running the model drive app, click on three ellipsis dots on far right toolbar to see Command Checker which is very useful for inspecting your commands




































Under properties of your Clone Button, under Actions, you will find Expression Function with details about your formula code!
Under the compiled script you can even find the URL to the javascript used by your formula.





















✨How to update grid records FAST

See video at 17:50 for Slow Version vs Fast Version of updating a bunch of records
Here is the Fast version: Notice the Patch is at the top! This is better! because we are passing a collection of records rather than one at a time, so faster to run






















✨Know how component library publishing really works
✨Catch & Handle errors in your command button commands















✨A few bonus tips are thrown in!

Join Scott on the Microsoft Canada Developer Digital Meetup Tour:

Learn more: 🔗 https://learn.microsoft.com/en-us/pow... 🔗 Comparison between Ribbon Workbench and modern commanding - https://develop1.net/public/post/2021... Contents: 00:00 Introduction 00:31 Tip 1 - How to clone a record including child records 07:59 Tip 2 - How to control the visibility of a button depending on the state of a form 08:53 Tip 3 - Know how component library publishing really works 12:04 Tip 4 - How to update grid records FAST 14:36 Tip 5 - Catch & Handle errors in your command button commands 16:44 Join Scott on the Microsoft Developer Digital Meetup Tour!

Comments

Popular posts from this blog

Clone Command Bar Button in Model Driven App: Order & OrderDetails

Knowledge shared is power squared!