Sonoma Partners Microsoft CRM and Salesforce Blog

Discount Approval Emails with Dynamics 365 and Microsoft Flow

Today's blog post was written by Bryson Engelen and Kevin Yamashita, Sales Engineers at Sonoma Partners.

If you’re looking to do simple approval emails, there are some really easy ways to move data from Dynamics CRM to Outlook that don’t require any code. It allows a manager to approve, for example, a 10% discount, all while on their phone or sitting at their desk without the need to jump into CRM.

Below, we’ll walk through the basics of creating an approval email that brings in data from Dynamics CRM.

If you need more detail, or something more sophisticated, we’ve got the tools and expertise to take things further. This is just a simple way to get started, and you can see a video of the output here.

First, you’ll need an environment to test this out. Please don’t attempt this for the first time in production. You can provision trials for all of these components. Note: If you request a tenant with Project Service Automation, there is already an Approval Entity you can use. If you provision a 30-day trial and check the box saying you don’t want it customized, PSA won’t be loaded in, and you’ll need to create an Approval Entity in CRM. Additionally, 30-day trials don’t come with Outlook, so you’ll need to sign up for a free Office 365 trial in the Admin section of your Microsoft portal.

  1. CRM configuration
    1. Create a custom "Approval" Entity
      1. At a minimum, include a lookup field that points back to your originating entity (usually an Opportunity). If this is a Regarding field, you will encounter some limitations if you want to do more complex items like providing a link in the email to the Opportunity in CRM.
      2. Ensure the Approval Entity is enabled for Business Process Flows and Change Tracking (you can do this in the Default Solution).
      3. Optionally, include fields for added flavor such as a User lookup for "Approver," a yes/no field for "Approved," or a multi-line text field for "Approver Comments." If there are pieces of dynamic data that you want to include in your approval request email (including the recipient), be sure to include fields for that data on your Approval Entity.
    2. Create a new business process flow
      1. The primary entity should be the originating entity (again, Opportunity in most cases). Include one or two initial stages to capture basic Opportunity information (Estimated Close Date, Estimated Revenue, etc.).
      2. Add a conditional stage to branch off to if an approval is necessary. Usually our condition is if the Discount Percentage exceeds 10%. Note that you must include the field from the originating entity you want your condition to consider in the stage right before this conditional, approval stage.
      3. Create an Approval stage; in it, select your Approval entity and any relevant fields. This will prompt users to create a new Approval record when this stage is reached in the Business Process Flow.
  1. Flow configuration
    1. Create a connection to CRM and to Outlook
      1. Navigate to the PowerApps website ( and sign in using the same credentials as Dynamics 365/Office 365. Go to the "Connections" section from the left navigation bar. Flow and PowerApps use the same underlying connection infrastructure, but this is only available from the PowerApps website, so you have to go there first.
      2. Create a new connection to "Dynamics 365."
      3. Create a new connection to "Office 365 Outlook."
    2. Create a new Flow
      1. Now navigate to the Flow website (, sign in, click "My Flows" in the top navigation bar, and select "Create from Blank" from the upper right-hand corner of the screen.
      2. First, we need to determine our trigger for this Flow; for this scenario, we'll use the creation of a new Approval record. Search for "Dynamics 365" and select "Dynamics 365 - When a record is created." Select your D365 organization and your custom "Approval" entity.

        Bryson 1_750
        Now we need to configure a step to send an approval email: select "+ New Step," "Add an action," search for "Approval," and select "Office 365 Outlook - Send approval email." You can now define the details of that approval request email (recipient, subject, body, etc.). Note that you can enter in static values or you can pull dynamic values from the originating Approval record via the dynamic content sidebar on the right that appears when you click into a given field.

        Bryson 2_750
      3. Next, we'll add a conditional step based on the approval response. Select "+ New Step" and "Add a condition." On the left-hand side, click the condition's "Choose a value" field and select the "SelectedOption" value from the dynamic content sidebar. On the right-hand side, click the condition's "Choose a value" field and type in "Approve" (unless you opted to change the approval options in the previous step; if so, use whatever text value you opted for).
      4. Finally, in each branch of the condition we will write the approval response back to CRM. After this you could add additional steps if you wanted. Click "Add an action" under the IF YES branch, search for "Dynamics 365," and select "Dynamics 365 - Update a record." Like in the trigger step, select your D365 organization and the custom "Approval" entity. In the "Record identifier" field lookup the unique identifier of the Entity (either the “Activity” field or the Entity name - if you set the Entity up as an Activity, choose “Activity,” if non-Activity Entity, choose Entity name) and then set any other fields that you desire for that branch of the Flow (at a minimum, you'll want to update your Approval record's "Approval Status" field). ANY REQUIRED field on the Entity will need to have that field set in Flow, so for example, if the “Subject” field is required, just populate that field with the “Subject” option in the dynamic content list.

        Bryson 3_750
      5. To update the Status, you’ll need to update whatever Status field is on your Entity. Often, this is the “Approval Status” field, so under the IF YES branch, hit “Show Advanced options” and find the “Approval Status” field in the list. Here you will need to enter the numeric value of the “Approved” option set value, which will look something like 100000003 (you’ll need to delete the commas if you copy and paste this from CRM). From there, you can set up the IF NO branch by basically repeating steps v. and vi. under the IF NO branch, except in the “Approval Status” field you will want to enter whatever numeric value corresponds with your “Rejected” option set value, which is likely 100000002.

        Bryson 4_750
      6. Then hit Save Flow and Done (depending on how frequently you saved, it may be Update Flow).
      7. Now save your Flow and give it a test by creating a new Approval record in D365!

Bryson 5_750

A few last things we will mention. For ease of use, it might make sense to populate the “Description” field of your approval record in CRM with something that reads well in the email (like we have in the image above). Also, there are more complex things you can do with this, like adding a hyperlink in the email to jump to the record in CRM (which would require a custom Workflow Utility like the one Sonoma Partners can provide you), embedding mobile deep links, or writing a workflow to copy information from the Opportunity record to the Approval record so the email picks up on that data. We can provide details on those in another set of instructions, but for now you have the basics.

Topics: Microsoft Dynamics 365