This article will provide you with a walk-through on creating a flow to automate a quote approval process in Dynamics 365 Sales. It is based on the following business scenario:
Today, your sales reps generated Opportunities and Quotes in Dynamics 365 Sales. If a Quote is above $50,000, the sales rep must get approval on the Quote from a Sales Manager before they can send the Quote to the customer. Today, this is done manually via email. You, as the System Administrator, are going to automate this process for the team using Power Automate and the Approval connector.
Here is the final Power Automate flow this article will walk you through – which will automate the quote approval process for the sales reps and managers:
1. Configure the Trigger: When a row is added, modified or deleted
We are going to use a Dataverse trigger When a row is added, modified or deleted. You will configure the following:
- Change type: Modified
- Table name: Quotes
- Scope: Organization
We want to ensure that this flow is only triggered when the following criteria are met:
- Quote status is Active
- Total Amount is $50,000+
To do this, you need to click the Show Advanced Options link in the trigger box. Then, you can add the following:
- Select columns: statecode, otalamount
(This ensure that the flow is only triggered when a value for one of these fields has changed.) - Filter rows: totalamount gt 49999 and statecode eq 1
(The flow will only run when a Quote has total amount greater than $49,999 AND the status is Active.)
HINT: Use the FetchXML Builder from Jonas Rapp (thanks Jonas!!) from the XrmToolBox to get your odata expressions to select columns and filter rows!
Your trigger should look like this:
2. Add an Action: Get a row by ID (Quote Owner)
This action step is necessary for a future step, when we need to use the Sales rep’s email address. In order to do that, we need to get the details of the Owner of the Quote record. This one is quite simple to configure. In your action step, select Get a row by ID using the Dataverse connector. Configure the following:
- Table name: Users
- Row ID: use dynamic content to get the Owner (Value) from the trigger
It should look like this once complete:
3. Add an Action: Get a row by ID (Potential Customer)
We need one more Get a row by ID action with the Dataverse connector: this time to get the Account details we will use in the Approval step. Configure the following:
- Table name: Accounts
- Row ID: use dynamic content to get the Potential Customer (Value) from the trigger
It should look like this once complete:
4. Add an Action: Start and wait for an approval
Then, we will add our next action. Search for the Approval connector, then select Start and wait for an approval.
Note: you may need to create a connection to the Approvals connector if this is your first time using it.
You can select from five options for your approval type:
- Approve/Reject – Everyone must approve
- Approve/Reject – First to respond
- Custom Responses – Wait for all responses
- Custom Responses – Wait for one response
- Enter custom value
In this scenario, we can select Approve/Reject – First to respond. Depending on your specific use cases, another option may be preferred.
Next, configure the additional properties of the Approval action. Use Dynamic content from your trigger step to personalize the approval message. It may look like this once you are complete (but obviously, select the appropriate Assigned to email addresses!):
5. Add an Action: Condition
Next, we will add an action for the Condition using the built-in Control connector. This will let us have a YES path, and a NO path.
We want our condition to be set to the Outcome (from the Approval step) is equal to Approve.
5a. Configure YES Path: Send an email (V2)
Next, in the Yes path, select the Send an email (V2) using the Office 365 Outlook connector. Configure the following:
- To:use Add dynamic content to get the email address from the Get a row by ID step above.
- Subject: Add dynamic content here to make it customized.
- Body: Add dynamic content here to make it customized.
If may look similar to this when you are complete:
Note: the Apply to Each was automatically added once I pulled in dynamic content for responses. This will happen to you as well if you add that information to your action step.
5b. Configure the NO Path: Send an email (V2)
Once again, we will select the Send an email (V2) using the Office 365 Outlook connector. Configure the following:
- To:use Add dynamic content to get the email address from the Get a row by ID step above.
- Subject: Add dynamic content here to make it customized.
- Body: Add dynamic content here to make it customized.
If may look similar to this when you are complete:
Note: the Apply to Each was automatically added once I pulled in dynamic content for responses. This will happen to you as well if you add that information to your action step.
Test, then publish!
Make sure to test your flow, then publish it and voila – you have automated this once manual Quote approval process for your sales reps and managers!
Note: This article was originally written for www.dynamicscommunities.com.