{"id":626,"date":"2023-02-20T01:09:00","date_gmt":"2023-02-20T01:09:00","guid":{"rendered":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/20\/adding-a-canvas-app-to-a-model-driven-app-part-3-completing-canvas-app-and-uploading-files-to-sharepoint-vs-dataverse\/"},"modified":"2023-02-20T01:09:00","modified_gmt":"2023-02-20T01:09:00","slug":"adding-a-canvas-app-to-a-model-driven-app-part-3-completing-canvas-app-and-uploading-files-to-sharepoint-vs-dataverse","status":"publish","type":"post","link":"https:\/\/automatethemundane.com\/index.php\/2023\/02\/20\/adding-a-canvas-app-to-a-model-driven-app-part-3-completing-canvas-app-and-uploading-files-to-sharepoint-vs-dataverse\/","title":{"rendered":"Adding a Canvas App to a Model Driven App-Part 3 Completing Canvas App and Uploading files to SharePoint vs Dataverse"},"content":{"rendered":"\n<p class=\"has-text-color\" style=\"color: rgba(120, 119, 116, 1)\">2\/20\/2023<\/p>\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity is-style-wide\"\/>\n\n\n<h1 class=\"wp-block-heading\">The Why<\/h1>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\">This section will guide you through completing the canvas app, enabling it to save documents to the SharePoint Document library vs saving it to Dataverse, and marking the file as complete in Dataverse. <\/p>\n\n\n<h1 class=\"wp-block-heading\">The How<\/h1>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\">This guide is built as thought the SharePoint Document Library Integration has been configured and is live. Use the following guides to properly configure the integration. <\/p>\n\n\n<h2 class=\"wp-block-heading\">App Design<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li>Add a save icon to the gallery. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-1024x328.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Set the template fill to a IF statement based off of the Completed column. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-1-1024x249.png\" alt=\"\"\/><\/figure>\n\n\n<pre class=\"wp-block-code\"><code>If(\n    Text(ThisItem.Completed) = &quot;No&quot;,\n    RGBA(\n        0,\n        0,\n        0,\n        0\n    ),\n    LightGreen\n)<\/code><\/pre>\n<\/li>\n\n\n\n<li>Set the attachment control to hide if the attachment is marked as completed. \n<pre class=\"wp-block-code\"><code>If(\n    Text(ThisItem.Completed) = &quot;No&quot;,\n    true\n)<\/code><\/pre>\n<\/li>\n\n\n\n<li>To prevent users from uploading files when nothing is attached, we can hide the save icon until a file is attached.<\/li>\n\n\n\n<li>Select the save icon, set the visible to hidden until an attachment is added<\/li>\n<\/ol>\n\n\n<pre class=\"wp-block-code\"><code>!IsBlank(First(attachmentControlUS.Attachments).Value)<\/code><\/pre>\n\n\n<h2 class=\"wp-block-heading\">Upload form with Automate Flow<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li>From the left hand pane create a new flow\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-2-1024x467.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Delete the Power Apps trigger and replace it with the Power Apps V2 trigger. Add the following items to the trigger\n<ol class=\"wp-block-list\">\n<li> Document Type<\/li>\n\n\n<li>Document Name<\/li>\n\n\n<li>Request ID<\/li>\n\n\n<li>Document ID<\/li>\n\n\n<li>File Content\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-3.png\" alt=\"\"\/><\/figure>\n<\/li>\n<\/ol>\n<\/li>\n\n\n\n<li>Add a SharePoint Create a file action\n<ol class=\"wp-block-list\">\n<li>The SharePoint site will be the one configured for the particular table<\/li>\n\n\n<li>The Folder Path will match the folder path setup during the custom SharePoint link<\/li>\n\n\n<li>The File Name is a concatenation of the Document type and the file name<\/li>\n\n\n<li>The File Content will be the file content from the trigger<\/li>\n<\/ol>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-4-1024x405.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Add a SharePoint Get file properties action. This action is used to get the SharePoint URL and other attributes\n<ol class=\"wp-block-list\">\n<li>The Site address is the same as above<\/li>\n\n\n<li>The Library is the same as above<\/li>\n\n\n<li>The Id is the ID from the above action<\/li>\n<\/ol>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-5-1024x456.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Add a Dataverse Update a row action\n<ol class=\"wp-block-list\">\n<li>The Table name will be the documents table<\/li>\n\n\n<li>The Row ID will be the Document ID from the trigger<\/li>\n\n\n<li>The Completed will be marked as \u201cyes\u201d<\/li>\n\n\n<li>the SharePoint Link will be gathered from the above action. <\/li>\n<\/ol>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-6-1024x955.png\" alt=\"\"\/><\/figure>\n<\/li>\n<\/ol>\n\n\n<h2 class=\"wp-block-heading\">App code<\/h2>\n\n\n<p class=\"has-text-color\" style=\"color: rgb(0, 0, 0)\">Back in the canvas app we will now finish the app and the code to kick off the flow. <\/p>\n\n\n<ol class=\"wp-block-list\">\n<li>Add a new screen to the app called Complete Screen\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-7-1024x359.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>On the gallery save icon add the following code\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-8-1024x363.png\" alt=\"\"\/><\/figure>\n\n\n<pre class=\"wp-block-code\"><code>Select(Parent);\nUploadfiletoSharePointandmarkascompletedinDataverse.Run(\n    ThisItem.&#039;Document Type&#039;,\n    First(attachmentControlUS.Attachments).Name,\n    ThisItem.&#039;Customer Requests&#039;.&#039;Customer Requests&#039;,\n    ThisItem.&#039;Purchase Request Documents&#039;,\n    {\n        contentBytes: First(attachmentControlUS.Attachments).Value,\n        name: First(attachmentControlUS.Attachments).Name\n    }\n);\nNavigate(&#039;Complete Screen&#039;)<\/code><\/pre>\n<\/li>\n\n\n\n<li>The canvas app is now ready to test.<\/li>\n<\/ol>\n\n\n<h2 class=\"wp-block-heading\">Testing the App<\/h2>\n\n\n<ol class=\"wp-block-list\">\n<li>From the MDA create a new record. The Canvas app along with the documentation location will be displayed\/created. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-9-1024x496.png\" alt=\"\"\/><\/figure>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-10-1024x294.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>Upload a file using the document control and verify that the file uploads and is marked as completed. \n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-11-1024x406.png\" alt=\"\"\/><\/figure>\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/09\/untitled-12-1024x254.png\" alt=\"\"\/><\/figure>\n<\/li>\n\n\n\n<li>The app&#039;s core functionality and flow have been completed. Further enhancements can now be made to the UI to improve the canvas app.<\/li>\n<\/ol>\n\n","protected":false},"excerpt":{"rendered":"<p>2\/20\/2023 The Why This section will guide you through completing the canvas app, enabling it to save documents to the SharePoint Document library vs saving it to Dataverse, and marking the file as complete in Dataverse. The How This guide is built as thought the SharePoint Document Library Integration has been configured and is live. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":135,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[18,4,5,29],"class_list":["post-626","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","tag-canvas-app","tag-mda","tag-power-apps","tag-power-automate","entry","has-media"],"jetpack_featured_media_url":"https:\/\/automatethemundane.com\/wp-content\/uploads\/2023\/05\/cover-9-scaled.jpg","_links":{"self":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/626","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=626"}],"version-history":[{"count":0,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/posts\/626\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media\/135"}],"wp:attachment":[{"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/media?parent=626"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/categories?post=626"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/automatethemundane.com\/index.php\/wp-json\/wp\/v2\/tags?post=626"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}