<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:media="http://search.yahoo.com/mrss/"><channel><atom:link href="https://www.mscrm-addons.com/DesktopModules/LiveBlog/API/Syndication/GetRssFeeds?Tag=power-automate&amp;mid=2185&amp;PortalId=0&amp;tid=165&amp;ItemCount=20" rel="self" type="application/rss+xml" /><title>News.mscrm-addons.com Blog</title><description>Hello and welcome to our blog! 

What can we do for you? 
Are you looking for further technical information or step-by-step instructions to our products? Or would you like to read the latest news on mscrm-addons?
Please feel free to browse our blog for detailed information and to share our posts! </description><link>https://www.mscrm-addons.com/Blog</link><item><title>Step-by-Step: How to generate documents in Power Automate (Microsoft Flow)</title><link>https://www.mscrm-addons.com/Blog/PostId/10236/step-by-step-how-to-generate-documents-in-microsoft-flow</link><category>*General*,DocumentsCorePack (DCP),DCP 365</category><pubDate>Wed, 06 Nov 2019 13:13:08 GMT</pubDate><description>&lt;p style="text-align: justify;"&gt;Power Automate is becoming more powerful every day and potentially is about to replace the long-standing classic Dynamics 365 workflows. In this blog, we will present and showcase how DocumentsCorePack allows us to generate and process documents within Power Automate (Microsoft Flow).&lt;/p&gt;
&lt;p style="text-align: justify;"&gt;&lt;strong&gt;&lt;span style="font-size: 18px; color: #0077b3;"&gt;How it works:&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;
When using DocumentsCorePack every document that has to be generated is defined by a record of an entity called &amp;ldquo;AutoMergeWorkingItem&amp;rdquo;. This record holds all mandatory definitions to generate the document:&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: justify;"&gt;&lt;strong&gt;1. Record to use:&amp;nbsp;&lt;/strong&gt;&amp;nbsp;What record should the document be generated for (e.g. account, quote, etc.)&lt;br /&gt;
&lt;strong&gt;2. Template to execute:&lt;/strong&gt; ​&amp;nbsp;Defines the DocumentsCorePack template that should be used to generate the document.&lt;br /&gt;
&lt;strong&gt;3. Output format: &lt;/strong&gt;​The Filetype the document should be generated and returned as Pdf, docx, Html.&amp;nbsp;&lt;br /&gt;
&lt;strong&gt;4. (Optional) Processing settings:&lt;/strong&gt; This is not a necessity but DocumentsCorePack allows to not just generate a document but also process the document by definitions on the AutoMerkeWorkingItem record (e.g. Print, Save to SharePoint, Send for e-Signing, etc.).&amp;nbsp;&lt;/p&gt;
&lt;p style="text-align: justify;"&gt;Once such an AutoMergeWorkingItem is created, the DocumentsCorePack service will generate the document and deliver it back as an attachment to this record. It becomes clear that in order to generate a document within Flow the only thing that needs to be done is to &lt;strong&gt;&amp;ldquo;Create an AutoMergeWorking Item Record&amp;rdquo;&lt;/strong&gt;. &lt;/p&gt;
&lt;p style="text-align: justify;"&gt;&lt;strong&gt;Note: &lt;/strong&gt;The mandatory parameters required can be brought into flow in various ways. E.g. you could build a Canvas App that passes the parameters to the Flow or you can simply use the Common Data Service or Dynamics 365 connectors within Flow to load them (see figure below).&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Document generation request schema of DocumentsCorePack " href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure1.png"&gt;
&lt;img alt="Document generation request schema of DocumentsCorePack" width="544" height="265" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure1.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 1: Document generation request&amp;nbsp;schema of DocumentsCorePack&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;span style="font-size: 18px; color: #0077b3;"&gt;Step-by-Step: Create an AutoMergeWorkingItem in Power Automate (Microsoft Flow)&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;Now that we know what is needed: Let&amp;rsquo;s take a look at how such a document generation request has to look like. &lt;/p&gt;
&lt;p&gt;Our use case is to generate a quote document in PDF &amp;ndash; format upon activation of the quote. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Note: &lt;/strong&gt;In our scenario, we are using the common data service connector. Especially with the October 2019 update for the &amp;ldquo;Common Data Service (current environment)&amp;rdquo; it became a lot easier to do certain things like creating records. I want to emphasize though that it's of course also possible to use the Dynamics 365 connector.&lt;strong&gt;&lt;span style="font-size: 18px; color: #0077b3;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;1. The Trigger of the flow:&lt;/strong&gt; In our scenario, the flow is defined to trigger a change of the status field of the quote entity as follows:&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="The Trigger of the flow" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure2.png"&gt;
&lt;img alt="The Trigger of the flow" width="316" height="154,5" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure2.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 2: The Trigger of the flow&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;What&amp;rsquo;s important:&lt;/strong&gt; We will need the context of this step as it defines the record our document needs to pull the data from. So we have the first required parameter: The record to use! &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;2. Get Template to execute:&lt;/strong&gt; Here we use the Common Data Service- 'Get Record' action to load our template. Since we always want to use the same quote-template we make it simple and &amp;ldquo;hardcode&amp;rdquo; our template.&amp;nbsp;&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Get template to execute" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure3.png"&gt;
&lt;img alt="Get template to execute" width="317" height="88,5" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure3.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 3: Get template to execute&lt;/em&gt;&lt;/div&gt;
&lt;p class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;​&lt;/em&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;So what do we have here? Where does this GUID in the item identifier come from? To answer this we have to know that every template designed with the DocumentsCorePack Template Designer is stored as a record of the &amp;ldquo;mscrm-addons.com DocumentsCorePack Template&amp;rdquo; entity. As can be seen on the screenshot this is the entity we are getting a record of.&lt;/p&gt;
&lt;p&gt;You can e.g. open the template record you want to use and copy the GUID from the URL as you can see below.&amp;nbsp;&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Open template record" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure4.png"&gt;
&lt;img alt="Open template record" width="650,5" height="208,5" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure4.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 4: Open template record&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;To summarize:&lt;/strong&gt;&amp;nbsp;This 'Get Record' step will provide us with the second parameter: The template to use! As we also know that our output format should be PDF we are all set to finally define our document generation request!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;3. Create AutoMergeWorking Item: &lt;/strong&gt;As all parameters are now clear we can use the Common Data Service &amp;ndash; Create Record action to create our document generation request as follows:&amp;nbsp;&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Create AutoMergeWorking Item" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure5.png"&gt;
&lt;img alt="Create AutoMergeWorking Item" width="420" height="168" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure5.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 5: Create AutoMergeWorking Item&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;We create a record of the Entity &amp;ldquo;MSCRM-ADDONS.COM AutoMergeWorkingItem&amp;rdquo; and choose the Action to be &amp;ldquo;Create Document&amp;rdquo;. We can also give it a name that is quite handy to maybe later identify and review the documents generated via this Flow. Now we need to set our parameters: &lt;/p&gt;
&lt;p&gt;a. Record to pull data from (PrimaryRecordUrl):&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Record to pull data from (PrimaryRecordUrl)" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure6.png"&gt;
&lt;img alt="Record to pull data from (PrimaryRecordUrl)" width="470,5" height="65,5" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure6.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 6: Record to pull data from (PrimaryRecordUrl)&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is kind of challenging at this point. We did copy the URL of a quote we opened in Dynamics and replaced it with the &amp;ldquo;Quote&amp;rdquo;-parameter (Unique identifier of the quote from our Flow-Trigger action).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;b. Template to Execute (TemplateToExecute):&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="Template to Execute (TemplateToExecute)" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure7.png"&gt;
&lt;img alt="Template to Execute (TemplateToExecute)" width="479" height="26" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure7.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 7: Template to Execute (TemplateToExecute)&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Here we reference the Unique Identifier parameter of our &amp;ldquo;Get Record&amp;rdquo; step where we did load the template above.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;c. FileType (SaveAs Value): This is a simple one &amp;ndash; we simply select &amp;ldquo;PDF&amp;rdquo; from our picklist.&amp;nbsp;&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="FileType (SaveAs Value)" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure8.png"&gt;
&lt;img alt="FileType (SaveAs Value)" width="512,5" height="27" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure8.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 8: FileType (SaveAs Value)&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;And that&amp;rsquo;s it!&lt;/strong&gt; We did it. So every time a quote gets activated we will now get a document generated.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Next steps: &lt;/strong&gt;Naturally you want to do something with the document once generated. As outlined above you can either use the AutoMergeWorkingItem to process the document but you can also process the document within your flow. The generated document can be found on the AutoMergeWorkingItem record -&amp;gt; Created Document section. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;Note&lt;/strong&gt;: This field will be filled when DocumentsCorePack successfully created the document. You will have to wait for the AutoMergeWorkingItem record to become &amp;ldquo;inactive&amp;rdquo;. This tells you that the document is ready.&amp;nbsp;&lt;/p&gt;
&lt;div class=" data-plugin-options="&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;
&lt;a title="AutoMergeWorkingItem information: Inactive status" href="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure9.png"&gt;
&lt;img alt="AutoMergeWorkingItem information: Inactive status" width="647,5" height="445" class="img-responsive" src="/Portals/0/Blog/StepByStep_How_to_generate_documents_in_Microsoft_Flow/Figure9.png" /&gt;
&lt;/a&gt;&lt;/div&gt;
&lt;div class="lightbox" data-plugin-options="{'delegate': 'a', 'type': 'image', 'gallery': {'enabled': false}}"&gt;&lt;em&gt;Figure 9: AutoMergeWorkingItem information: Inactive status&lt;/em&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color: #fcfcfc; text-align: justify;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-size: 13px;"&gt;&lt;span style="background-color: #fcfcfc; text-align: justify;"&gt;&lt;strong&gt;That's it!&lt;/strong&gt;&lt;/span&gt;&lt;span style="background-color: #fcfcfc; text-align: justify;"&gt;&amp;nbsp;We appreciate your feedback! Please share your thoughts by sending an email to&amp;nbsp;&lt;/span&gt;&lt;a href="mailto:support@mscrm-addons.com" style="background-color: #fcfcfc; text-align: justify;"&gt;support@mscrm-addons.com&lt;/a&gt;&lt;span style="background-color: #fcfcfc; text-align: justify;"&gt;.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;</description><guid isPermaLink="false">10236</guid></item></channel></rss>