{"id":18396,"date":"2019-05-08T10:48:01","date_gmt":"2019-05-08T10:48:01","guid":{"rendered":"https:\/\/www.inogic.com\/blog\/?p=18396"},"modified":"2020-06-01T12:56:29","modified_gmt":"2020-06-01T12:56:29","slug":"qualify-lead-in-dynamics-365-through-the-canvas-app-with-microsoft-flow","status":"publish","type":"post","link":"https:\/\/www.inogic.com\/blog\/2019\/05\/qualify-lead-in-dynamics-365-through-the-canvas-app-with-microsoft-flow\/","title":{"rendered":"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow"},"content":{"rendered":"<h2><strong>Introduction<\/strong><\/h2>\n<p style=\"text-align: justify;\">PowerApps is a data platform that provides rapid application development environment to build custom apps for your business needs.<\/p>\n<p style=\"text-align: justify;\">In PowerApps you can only perform operations such as create, update and delete. However, to perform more operation you can go for other options such as Microsoft Flow etc.<\/p>\n<p style=\"text-align: justify;\">In this case we created an application named Lead Management for Dynamics 365 CRM to perform certain operation on lead. We were able to access, create, update and delete the lead related data but could not qualify the lead. Qualify is the action in Dynamics 365 CRM to generate Opportunity, Account and Contact from the lead. So for this action we used Microsoft Flow to qualify the lead.<\/p>\n<p><strong>Solution: &#8211;<\/strong> <strong>In order to qualify the Lead in Dynamics 365 CRM we can use CRM Web API Request through Microsoft Flow to perform this operation.<\/strong><\/p>\n<p><strong>Step 1<\/strong><\/p>\n<p>Create new canvas Dynamics 365 CRM app. You can find more about canvas app from <a href=\"https:\/\/www.inogic.com\/blog\/2018\/07\/create-records-in-dynamics-365-with-canvas-powerapp\/\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/p>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18397\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/1Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"604\" height=\"172\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/1Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 604w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/1Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x85.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\n<p><strong>Step 2<\/strong><\/p>\n<p>Select data source as Lead.<\/p>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18398\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/2Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"604\" height=\"179\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/2Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 604w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/2Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x89.png 300w\" sizes=\"(max-width: 604px) 100vw, 604px\" \/><\/p>\n<p><strong>Step 3<\/strong><\/p>\n<p>Step 2 will build new mobile application for you which would be having three screens<\/p>\n<ul>\n<li>Brows Screen1<\/li>\n<li>Detail Screen 1<\/li>\n<li>Edit Screen 1<\/li>\n<\/ul>\n<p style=\"text-align: justify;\">Select the Detail Screen 1 (name can be changed) and from the insert tab go to icon and put a new icon on the action bar as below. We have used an <strong>Arrow Icon.<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-18399\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"1352\" height=\"447\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 1352w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x99.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-768x254.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-1024x339.png 1024w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/3Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-660x218.png 660w\" sizes=\"(max-width: 1352px) 100vw, 1352px\" \/><\/p>\n<p><strong>Step 4<\/strong><\/p>\n<p>Go to the Action Tab select flow and create new Microsoft flow that will bring you in the<\/p>\n<p>Microsoft flow app.<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-18400\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/4Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"857\" height=\"429\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/4Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 857w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/4Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x150.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/4Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-768x384.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/4Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-660x330.png 660w\" sizes=\"(max-width: 857px) 100vw, 857px\" \/><\/p>\n<p><strong>Step 5<\/strong><\/p>\n<p style=\"text-align: justify;\">Add New Step in the flow and select http request and give name as per your choice. We have named it as <strong>Request Token. <\/strong>In this step we are obtaining the access token that can be used to execute the QualifyLead Web API request.<\/p>\n<p style=\"text-align: justify;\">Here we are using the Application User which is non-licensed to generate the Access token. As a prerequisite you must perform the below steps;<\/p>\n<ul>\n<li>First we have to register an Application on the Azure Active Directory. For more information click <a href=\"https:\/\/docs.microsoft.com\/en-us\/dynamics365\/customer-engagement\/developer\/walkthrough-register-dynamics-365-app-azure-active-directory\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/li>\n<li>Then create Application user on the Dynamics 365 CRM. For more information click <a href=\"https:\/\/docs.microsoft.com\/en-us\/previous-versions\/dynamicscrm-2016\/developers-guide\/mt790170(v%3dcrm.8)#create-an-application-user-associated-with-the-registered-application-in-dynamics-365\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a>.<\/li>\n<\/ul>\n<p>From these steps you will get the client id and secret key of your registered application in AAD.<\/p>\n<p><strong>Pass parameter to the HTTP step as below<\/strong>:<\/p>\n<p><strong>Method<\/strong>: &#8211; POST<\/p>\n<p><strong>URI: &#8211;<\/strong> <a href=\"https:\/\/login.microsoftonline.com\/00000000-0000-0000-0000-000000000000\/oauth2\/token\">https:\/\/login.microsoftonline.com\/00000000-0000-0000-0000-000000000000\/oauth2\/token<\/a><\/p>\n<p>&lt;This is the OAuth 2.0 Token Endpoint&gt;<\/p>\n<p><strong>Headers<\/strong><\/p>\n<ul>\n<li>Accept : application\/json<\/li>\n<li>Content-Type : application\/x-www-form-urlencoded<\/li>\n<\/ul>\n<p><strong>Body<\/strong><\/p>\n<ul>\n<li>grant_type=client_credentials<\/li>\n<li>client_id=&lt;Application Id of registered application in Azure Active Directory&gt;<\/li>\n<li>client_secret=&lt;Secret key of registered application in Azure Active Directory&gt;<\/li>\n<\/ul>\n<p>resource= &lt;crm url&gt; e.g. https:\/\/contoso.crm.dynamics.com<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-18401\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/5Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"685\" height=\"498\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/5Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 685w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/5Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x218.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/5Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-660x480.png 660w\" sizes=\"(max-width: 685px) 100vw, 685px\" \/><\/p>\n<p><strong>Step 6<\/strong><\/p>\n<p>In this step we will add a variable to store our Authentication token. Name it as Access Token, type will be String and value = <strong>@{body(&#8216;RequestToken&#8217;)[&#8216;access_token&#8217;]}\u00a0 or body(&#8216;RequestToken&#8217;)?[&#8216;access_token&#8217;]\u00a0 <\/strong><\/p>\n<p style=\"padding-left: 40px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18402\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/6Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"610\" height=\"176\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/6Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 610w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/6Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x87.png 300w\" sizes=\"(max-width: 610px) 100vw, 610px\" \/><\/p>\n<p><strong>Step 7<\/strong><\/p>\n<p>Now add another http request and set the parameter as below to qualify the lead,<\/p>\n<p><strong>Method<\/strong>: &#8211; POST<\/p>\n<p><strong>URI<\/strong>: &#8211; https:\/\/contoso.crm.dynamics.com\/api\/data\/v9.1\/leads(\u2060&lt;<strong>Lead id will be passed from PowerApps<\/strong>&gt;)\/Microsoft.Dynamics.CRM.QualifyLead<\/p>\n<p><strong>Headers:<\/strong><\/p>\n<p>{<\/p>\n<p>&#8220;Authorization&#8221;: &#8220;Bearer &lt;<strong>Put the Access Token Variable<\/strong>&gt;\u200b&#8221;,<\/p>\n<p>&#8220;Accept&#8221;: &#8220;application\/json&#8221;,<\/p>\n<p>&#8220;Content-Type&#8221;: &#8220;application\/json; charset=utf-8&#8221;,<\/p>\n<p>&#8220;OData-MaxVersion&#8221;: &#8220;4.0&#8221;,<\/p>\n<p>&#8220;OData-Version&#8221;: &#8220;4.0&#8221;<\/p>\n<p>}<\/p>\n<p><strong>Body:<\/strong><\/p>\n<p>{<\/p>\n<p>&#8220;CreateAccount&#8221;: true,<\/p>\n<p>&#8220;CreateContact&#8221;: true,<\/p>\n<p>&#8220;CreateOpportunity&#8221;: true,<\/p>\n<p>&#8220;Status&#8221;: 3<\/p>\n<p>}<\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-18403\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/7Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"634\" height=\"580\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/7Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 634w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/7Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x274.png 300w\" sizes=\"(max-width: 634px) 100vw, 634px\" \/><\/p>\n<p><strong>The complete flow will look as follows;<\/strong><\/p>\n<p style=\"padding-left: 80px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18404\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/8Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"518\" height=\"411\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/8Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 518w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/8Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x238.png 300w\" sizes=\"(max-width: 518px) 100vw, 518px\" \/><\/p>\n<p style=\"padding-left: 80px;\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-18405\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/06\/Microsoft-Flow.jpg\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"516\" height=\"453\" \/><\/p>\n<p><strong>Step 8<\/strong><\/p>\n<p style=\"text-align: justify;\">At last go to PowerApps and set the triggering point of the Microsoft Flow on select of the Arrow Icon and pass the lead id to the Microsoft Flow. You can get Lead id from the Browse Gallery\u2019s selected record. This will give you current selected lead record. The formula will be as follows;<\/p>\n<p><strong>QualifyLeadbutton.Run(EncodeUrl(BrowseGallery1.Selected.Lead))<\/strong><\/p>\n<p><img decoding=\"async\" class=\"aligncenter size-full wp-image-18406\" style=\"border: 1px solid #0a0a0a; padding: 1px; margin: 1px;\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/10Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png\" alt=\"Qualify Lead in Dynamics 365 through the Canvas App with Microsoft flow\" width=\"840\" height=\"68\" srcset=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/10Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow.png 840w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/10Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-300x24.png 300w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/10Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-768x62.png 768w, https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/10Qualify-Lead-in-Dynamics-365-through-the-Canvas-App-with-Microsoft-flow-660x53.png 660w\" sizes=\"(max-width: 840px) 100vw, 840px\" \/><\/p>\n<h2><strong>Conclusion<\/strong><\/h2>\n<p style=\"text-align: justify;\">There is no direct method in PowerApps to perform special operations. But, by using Microsoft Flow we can authenticate to CRM Web API and perform special operations or request like WinOpportunity, QualifyLead etc.<\/p>\n<p><a href=\"https:\/\/www.inogic.com\/product\/development\/microsoft-flow-logic-apps-dynamics-365\" target=\"_blank\" rel=\"noopener noreferrer\"><img decoding=\"async\" class=\"aligncenter wp-image-18419\" src=\"https:\/\/www.inogic.com\/blog\/wp-content\/uploads\/2019\/05\/PowerApps-2.png\" alt=\"\" width=\"816\" height=\"204\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction PowerApps is a data platform that provides rapid application development environment to build custom apps for your business needs. In PowerApps you can only perform operations such as create, update and delete. However, to perform more operation you can go for other options such as Microsoft Flow etc. In this case we created an\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.inogic.com\/blog\/2019\/05\/qualify-lead-in-dynamics-365-through-the-canvas-app-with-microsoft-flow\/\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":13,"featured_media":18410,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[16,36,1985],"tags":[1867,1150],"class_list":["post-18396","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-dynamics-365","category-microsoft-flow","category-power-automate","tag-canvas-app","tag-microsoft-flow"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/18396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/comments?post=18396"}],"version-history":[{"count":0,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/posts\/18396\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media\/18410"}],"wp:attachment":[{"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/media?parent=18396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/categories?post=18396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.inogic.com\/blog\/wp-json\/wp\/v2\/tags?post=18396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}