Part 1 & 2 explains how to create custom entities, fields and import data. In this blog we will create Model Driven App using entities we created and publish it to Dynamics 365.
- Login to PowerApp web portal and select design mode as “Model-Driven” in lower left corner. Refer my blog in case “Model Driven” option is not visible
- Click on + New App. Give a name to your app and click Done button. You can select Icon, define App URL suffix also as optional parameters.
- App designer screen will open with designer on left hand side and components to add on right hand side. Components here includes Entities, Dashboards, Forms, Views, Charts etc.
We will use Company and Company Products entities we created in Part 1 & 2 of series. CDS for apps automatically creates default forms and views when entity is created. We will configure sitemap, modify forms & views and finally publish app to Dynamics 365 as part of this blog. If you know how to configure sitemap, forms, views, charts, dashboard in Dynamics 365, this is a piece of cake.
- Click on arrow beside to Sitemap button in designer which will open sitemap designer
- Sitemap designer consists of 3 components:
- Area – represents a tile in sitemap navigation
- Group – divides one area in multiple sections
- Sub Area – consists of entities, dashboard, web resources
- Click on New Area, change Title as “Company. Click on New Group, change Title as “Products”. Click on New Subarea, select Type as Entity, select Entity as Company
- Select Products group, click +Add to add new Sub Area
- Select entity as Type, Company Product as Entity
- Click Save & Close from top right corner.
Refer blog for more details on how to customize sitemap for app.
- Select Entities from Components section on right side. Select Company and Company Product entities. As you select entity, entry will be added under Entity View in designer
- By default, all Forms, Views, Charts, Dashboards will be included.
Add & Modify Forms:
- Click on Forms button for Company entity in designer, all forms for Company entity will be loaded under Components. Select forms to be included in your app. Once selected you will see count of selected forms in Forms button. You can also create new form using Create New option
- In order to modify selected form, click on down arrow button to expand Forms button. Click on Form to be modified. Edit button will be enabled in top navigation, Click on Edit button
- Dynamics 365 Form editor screen will open. By default forms will have only Primary Field (Company Name) and Owner. We will add more fields under Company Name. Select Company Name field on form and then Double click on or drag “Account” field from Field Explorer onto form. Similarly, you can add as many fields you want. I have added Account & No. of Products as below:
- Once form is modified, click Save then publish then Save & Close
- Similarly, you can select and modify forms for Company Product entity
Refer blog for more details on how to customize forms (main, quick view, create)
Add & Modify Views:
- Click on Views button for Company entity in designer, all views for Company entity will be loaded under Components. Select views to be included in your app. Once selected you will see count of selected view in Views button. You can also create new view using Create New option. I have selected 2 views for my app: Active Companies and Inactive Companies
- Click on down arrow button to expand Views button. Click on view to be modified then Edit button
- View designer will open. You can change filters and add or remove columns. Expand filter Criteria section, Click on Add Filter. Apply filter as Company Name contains data as shown below
- To add more columns in view, click on Column Attributes – Primary entity in Components section on left. In case you need columns from related/child entity, click on Column Attributes – Related Entity. Double click on Account & No. of Products columns to add them in view
- Click on Save & Close. Similarly, you can modify other views, views for Company Products entity
Refer blog for more details on how to customize views
Publish app to Dynamics 365:
Once you are done with sitemap, entities, forms and views related changes. It’s to publish and run app in Dynamics 365
- Click on Validate in top right navigation of app designer screen to validate all customizations are correct. Once validated successfully Click Publish to publish your changes.
- Once published, click on Save & Close. You will be redirected to List of App window. Select “Company Products” App you created above and click on Play. Refresh page if you do not see app you created.
- It will launch Dynamics 365 application with your app running. Since we haven’t configured any dashboard, app will display Active Companies view by default.
- Select Company Product entity from Sitemap (on left hand side in Unified interface) and app will display Active Company Products view
- By default, app runs with Unified interface design but you can switch to classic web design. Select your app from Apps list and click on Edit (beside to Play button). Click on Properties beside to Components on right side. Scroll down and select Web instead of Unified Interface. Click Save -> Publish
- Select your app and click Play again. This time app will run with classic web interface with sitemap on top
Happy creating Power Apps.