Generate Documents from Microsoft Dynamics 365


Generate Documents from Microsoft Dynamics 365

With our Formstack Documents integration with Microsoft Dynamics 365, you can automatically generate contracts, NDAs, invoices & any other types of documents with a click of a button inside of Dynamics 365.

This means you no longer need to manually create & deliver your documents.

To get started, you'll need a Microsoft Dynamics account, a Formstack Documents account and a Microsoft PowerAutomate account.

How to Setup Integration

Step 1:  Upload / build your document template in Formstack Documents

To get started, we’re going to set up the template for our document.  You can upload a word, excel, ppt, pdf template or you can use our online document builder to build out your document template.  

In our example, we are going to show how to use the online document builder in Formstack Documents.  

From the Documents page in Formstack Documents, click the New Document button and enter a name.  On the next step, pick the “I want to build my document from scratch” option and then next.

Next, we’re going to set up our contract template in the document builder.  We’re going to add our logo, contact information, and then for the spots that we want to insert our customer/contract details from Microsoft Dynamics, we’re going to use merge fields that look like {$CustomerName}, {$Address}, {$Amount}, etc.

Here’s what our contract template looks like:

After we’ve finished our template and saved it, we’re going to move on to the Settings tab where we can modify various options like the type of file that’s generated and the name of the file.  For this example, we’re going to produce a PDF version of the contract and we’re going to include the name of our customer in the file name.


Next, we’re going to set up the delivery of our document so that it is automatically emailed to our customer.  

From the Deliver tab, click +New Delivery and then choose email.

For the To address we’re going to use a merge field for the customer’s email address.  If you don’t have a merge field in your template, choose the <<Other>> option then enter something like {$Email}.  Feel free to edit any of the other settings.

After we have saved our email delivery, we are done with the setup process inside Formstack Documents and we’re ready to setup the integration with Dynamics CRM using Microsoft Power Automate.

Step 2:  Setup Microsoft Dynamics & Formstack Documents flow in Power Automate

Log into your Microsoft Dynamics account and go to the entity that you’d like to create your documents from (ie.  Account, Contact, Opportunity...etc).  In our example, we are going to do this from the Account entity.

Click on the entity that you’d like to create your documents from & then click Flow>Create a Flow.

You’ll be automatically connected to a common data flow with your account.  Just click continue on the screen below.

Next, you’ll be brought to Power Automate where you will build out your flow.  You’ll see that your trigger step is already setup for you which is clicking a button in Microsoft Dynamics on the entity that you have chosen.  Accounts for us in our example.

You’ll want to rename your flow.  This will be used to name the button in Microsoft Dynamics that your team will click to generate this document.  Once this is done, click New Step to setup your action step in your flow.

You’ll want to choose Formstack Documents and then Merge Document as the action.

Once you’ve chosen your action, Power Automate will ask you to provide an API Key & Secret to connect to your Formstack Documents account.  

You can create an API Key & Secret in your Formstack Documents account by clicking Account>API Access>+ New API Key.  

Once you have your new API Key & Secret, simply copy and paste them into Power Automate to connect your accounts. Easy!

After we’ve authenticated our Formstack Documents account, Power Automate is going to load a list of the documents in our Formstack Documents account.  

Go ahead and select the template that you just set up and then Power Automate will load a list of the merge fields in your template.

For each merge field, you’ll need to map it to the corresponding field from Dynamics CRM.  This tells Power Automate how to send the data over to Formstack Documents so that it gets populated in the correct spot on your template.

After you’ve matched up all of your merge fields, go ahead and save your flow.  You’re ready for a test!  

For your test, simply login to Dynamics CRM, select a record in your chosen entity (ours was Accounts), click the 3 dots in the top right corner, click Flow>Generate Contract & then follow the prompts to run your flow.  Easy!

Your contract will automatically be created and sent to the customer via email. Welcome to the good life of automated documents!


Was this article helpful?
0 out of 0 found this helpful



Please sign in to leave a comment.