{"id":552,"date":"2023-02-19T14:54:00","date_gmt":"2023-02-19T14:54:00","guid":{"rendered":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/19\/adding-a-canvas-app-to-a-model-driven-app-part-1-design-and-initial-stage\/"},"modified":"2023-06-30T01:05:43","modified_gmt":"2023-06-30T01:05:43","slug":"adding-a-canvas-app-to-a-model-driven-app-part-1-design-and-initial-stage","status":"publish","type":"post","link":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/19\/adding-a-canvas-app-to-a-model-driven-app-part-1-design-and-initial-stage\/","title":{"rendered":"Adding a Canvas App to a Model Driven App-Part 1 Design and Initial Stage"},"content":{"rendered":"\n<p class=\"has-text-color\" style=\"color:rgba(120, 119, 116, 1)\">2\/19\/2023<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n\n<h1 class=\"wp-block-heading\">The Why<\/h1>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">Adding a canvas app to a model driven app can give users a more interactive and engaging experience. Canvas apps provide an intuitive way to interact with data and are customizable to suit the specific needs of the user. With the combination of model driven app data and the creativity of canvas app design, users can achieve powerful results.<\/p>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">This canvas app is designed to serve as a mandatory document checklist for the MDA series. It will provide users with the ability to upload necessary documents for purchase and track them using a checklist derived from a Dataverse table. The documents will be stored securely in SharePoint.<\/p>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">I prefer to store documents in SharePoint rather than Dataverse, as SharePoint is purpose-built for document management. Storing documents in Dataverse also consumes valuable storage.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">The How<\/h1>\n\n\n\n<h2 class=\"wp-block-heading\">Dataverse Table Design<\/h2>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">The table to be used for the document checklist will be as follows<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Document Name<\/th><th>Completed<\/th><th>SharePoint Link<\/th><th>Purchase Request ID<\/th><th>Purchase Type<\/th><th>Document Type<\/th><\/tr><\/thead><tbody><tr><td>String<\/td><td>Boolean<\/td><td>URL<\/td><td>Lookup<\/td><td>Choice<\/td><td>Choice<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Document Name\n<ul class=\"wp-block-list\">\n<li>String of the Document that will be created when the canvas app patches it to SharePoint<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Completed\n<ul class=\"wp-block-list\">\n<li>Boolean to mark if the document has been uploaded<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>SharePoint Link\n<ul class=\"wp-block-list\">\n<li>URL to SharePoint that will be created when the document has been uploaded<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Purchase Request ID\n<ul class=\"wp-block-list\">\n<li>The Lookup to the purchase request <\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Purchase Type\n<ul class=\"wp-block-list\">\n<li>A choice of either Purchase Card or Contract. This will be decided upon the amount selected during the purchase request. &lt; 1K Purchase Card, \u22651K Contract<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Document Type\n\n\n\n\n\n\n<ul class=\"wp-block-list\">\n<li>Each purchase type will require a certain set of documents. \n<ul class=\"wp-block-list\">\n<li>Purchase Card\n<ul class=\"wp-block-list\">\n<li>Justification Document<\/li>\n\n\n\n<li>Vendor Document<\/li>\n\n\n\n<li>Quote<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Contract\n<ul class=\"wp-block-list\">\n<li>Quote<\/li>\n\n\n\n<li>Vendor Research<\/li>\n\n\n\n<li>Company Contract Form<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Creating Canvas App<\/h2>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">There are two main ways to build and add a canvas app to a Model-Driven app: creating the canvas app and linking it to the MDA, or letting the Power Platform create it from the model-driven app. I find the latter to be more reliable, as it ensures the linkage is always correct.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>From the form of the MDA select switch to classic. This will bring up the Dynamics 365 form builder experience. \n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-87-1024x388.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-88-1024x410.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>For this example I have placed the created on column below the timeline in the input form. To add a canvas app to the form it needs a place to \u201clive\u201d, by using this automated column we can ensure that it will always been shown on the screen. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-89-1024x441.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Double click on the newly added column <\/li>\n\n\n\n<li>Deselect \u201cDisplay label on form\u201d. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-90.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Select Controls, then Add control\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-91.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Select Canvas App, then add\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-92.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Select Customize\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-93.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>This will start the auto build process for the app<\/li>\n\n\n\n<li>Immediately Save and Publish the app. The app is not ready, but this will ensure that it is created. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-94.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Close the Canvas App and go back to the Dynamics 365 Form Editor. Note that all the fields have been filled out for you. Press Ok. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-95.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Save, then Publish the Form\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-96-1024x447.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Close the Dynamics 365 form editor then refresh the form from the solution. The newly added part will now be shown at the bottom of the timeline. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-97-1024x592.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>You can return to this view at any point to see how the canvas app will look. <\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Editing the Canvas App<\/h2>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">The newly created canvas app will now be within the solution. <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-98-1024x349.png\" alt=\"\"\/><\/figure>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">But in its current form it is not able to do much. The next steps will be to shape the app to fit within the form and to connect it to the Newly created documents table from above. <\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>The first step will be to edit the overall size of the app so that it will fit withn the form. <\/li>\n\n\n\n<li>Select Settings, then display\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-99-1024x102.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Edit the Size so that it is 600x200 and in landscape mode. I have found that this size is best for a form. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-100-1024x586.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Add a new screen<\/li>\n\n\n\n<li>Delete the auto created screen. This will give you a completely blank app<\/li>\n\n\n\n<li>Add in the Documents Table\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-101.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Add two containers one for the Header and one for the gallery\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-102.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>In the Gallery add two labels, one for the type and one for the document name<\/li>\n\n\n\n<li>Filter the gallery using the customer request lookup and the ModelDrivenFormIntergration. This filter will ensure that only documents associated with the request will be shown. \n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-103-1024x227.png\" alt=\"\"\/><\/figure>\n\n\n\n<p class=\"has-background\" style=\"background-color:rgb(241, 241, 239)\">\ud83d\udca1 The ModelDrivenFormIntegration was automatically added when we added the canvas via the form. <\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Filter(\n    'Purchase Request Documents',\n    'Customer Requests'.'Customer Requests' = &#91;@ModelDrivenFormIntegration].Item.'Customer Requests'\n)<\/code><\/pre>\n<\/li>\n\n\n\n<li>In the header container add a label for the header\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-104.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Because there is no data in the database, nothing will be displayed on the screen. <\/li>\n\n\n\n<li>The next step will be to add the attachment upload. The best way to do this is to \u201csteal\u201d an attachment control from a SharePoint Lists form. I am using a temporary list that I have in my Teams space that I keep for this scenario.  \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-105-1024x544.png\" alt=\"\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-106-592x1024.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Copy and paste the control to the container, then remove any errors that come up. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-107-1024x428.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Then cut and paste the control to the gallery. By putting the control within the gallery we can upload individual documents to SharePoint and ensure they are named correctly. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-108-1024x368.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Change the attachment control to only allow one attachment \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/06\/untitled-109-1024x506.png\" alt=\"\"\/><\/figure>\n<\/li>\n<\/ol>\n\n\n\n<p class=\"has-text-color\" style=\"color:rgb(0, 0, 0)\">In the next guide we will go over how to create the checklist when a new item is created in the MDA. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>2\/19\/2023 The Why Adding a canvas app to a model driven app can give users a more interactive and engaging experience. Canvas apps provide an intuitive way to interact with data and are customizable to suit the specific needs of the user. With the combination of model driven app data and the creativity of canvas [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":136,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,6],"tags":[18,31,4],"class_list":["post-552","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-canvas-app","category-model-driven-app","tag-canvas-app","tag-forms","tag-mda","entry","has-media"],"jetpack_featured_media_url":"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/05\/cover-10-scaled.jpg","_links":{"self":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/552","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/comments?post=552"}],"version-history":[{"count":2,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/552\/revisions"}],"predecessor-version":[{"id":566,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/552\/revisions\/566"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media\/136"}],"wp:attachment":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media?parent=552"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/categories?post=552"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/tags?post=552"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}