Become a Dynamics 365 expert with Syvantis Learn
Provide additional details about the offer you're running.
This store requires javascript to be enabled for some features to work correctly.
Provide additional details about the offer you're running.
Build a Power Automate workflow from scratch for Dynamics 365 Sales
Power Automate • Power Platform • Dynamics 365 Sales
This Fast Class walks through building a Microsoft Power Automate workflow from scratch and connecting it to Dynamics 365 Sales. Using a new-account scenario, you’ll learn how to set a Dataverse trigger, generate and update an account number, add conditional logic, send an email notification, and troubleshoot and retest a flow. The example demonstrates how Power Automate can automate processes across applications with little to no code.
Microsoft Power Automate is a workflow tool that lets you automate processes across Microsoft and non-Microsoft systems without having to build the entire integration with custom code. Power Automate can monitor activity in applications, work with data, update records, send notifications, and connect multiple systems within the same workflow. In this example, we’ll build a flow from scratch that connects Power Automate with Dynamics 365 Sales.
The example workflow
The goal of this flow is to automate two actions whenever a new account is created in Dynamics 365 Sales:
The account-number logic in this example is intentionally simple. The purpose is to demonstrate the basic components of a Power Automate flow and how you can adapt them to more realistic business requirements.
Starting an automated cloud flow
Power Automate provides prebuilt templates for many common workflows, but you can also start from scratch. From My flows, create a new Automated cloud flow. Starting with a blank flow makes it easier to see how triggers, actions, conditions, and data work together. The first component you need is a trigger.
Choosing a Dataverse trigger
A trigger determines when a flow starts. A flow can be triggered manually or automatically when something happens in another application.
Dynamics 365 Sales stores its underlying data in Microsoft Dataverse. To automatically run the flow when a new CRM account is created, use a Dataverse trigger. Choose the trigger for when a row is added, modified, or deleted. Configure it to run when a new row is added to the Accounts table. The scope can also determine who can trigger the workflow.
In this example, the scope is set to the organization so the workflow can run when accounts are created across the organization.
Adding actions to the flow
Once the trigger is configured, you can begin adding actions.
Actions tell Power Automate what it should do after the trigger occurs. Depending on your workflow, actions can connect to Dynamics 365, Outlook, other Microsoft applications, or even non-Microsoft systems.
For this example, the first action generates an account number.
Creating an account number variable
A variable provides a way to store information that can be used later in the flow.
Add an Initialize variable action and create a variable for the account number. Variables can contain several types of information, including text, whole numbers, decimals, or true/false values. For the demonstration, the account number is stored as a string and generated using a random number between 0 and 10,000. A real-world account-number process would likely require more sophisticated logic.
For example, you might create a specific numbering format, use information from the account record, or retrieve a value from another system.
Checking whether an account number already exists
Before updating the account, the flow should determine whether an account number has already been entered. Add a condition that checks the account number field from the newly created record. If the field is null, meaning it contains no value, the workflow can proceed with generating and adding the account number. If an account number already exists, the flow leaves it unchanged. This prevents the workflow from overwriting an existing value.
Updating the Dynamics 365 account
If the account number is blank, add the Dataverse Update a row action. Select the Accounts table and use the unique identifier from the original trigger as the Row ID. This ensures that Power Automate updates the same account that triggered the workflow. Then populate the account number field with the value stored in the account-number variable. Fields that you leave blank in the update action are left unchanged.
Sending an email notification
The final part of the workflow sends an email notification when a new account is created. Add an Outlook email action and specify who should receive the notification. The email can contain dynamic information collected or created during earlier steps in the flow. For example, the message can include:
When adding dynamic content, pay attention to which previous step the information comes from. Multiple actions may expose similarly named fields, so selecting the correct source helps ensure that the email contains the intended information. The email itself can be simple or customized with more detailed formatting.
Saving and testing the flow
Once the actions and conditions are configured, save the flow to make it active. Create a new account in Dynamics 365 Sales to trigger the workflow. You can then review the flow's run history to see when it started, whether it completed successfully, and how each step operated. This run history is also useful when something does not work as expected.
Troubleshooting a flow
During the demonstration, the first test did not update the account number even though the overall flow ran. Reviewing the individual steps revealed that the condition was checking the wrong field. After replacing the incorrect value with the account number field, the flow was saved again.
This demonstrates an important benefit of Power Automate's run history: you can inspect the information moving through each step and identify where the logic isn't behaving as intended.
Retesting a previous run
You don't necessarily need to create another test record after correcting a flow. Power Automate can use a previous run to test the updated workflow again with the same input data. After fixing the condition, the previous run was tested again.
This time, Power Automate identified that the account number was blank, generated a number, updated the Dynamics 365 account, and sent the email notification.
Expanding the workflow
The completed example is a relatively simple flow, but the same structure can support much more complex business processes. Additional conditions and checks could help prevent duplicate account numbers or create account numbers according to specific business rules. The workflow could also retrieve or send information to other connected applications.
The key concepts remain the same: start with a trigger, add the actions and logic your process requires, use data from previous steps, and test the results. With these building blocks, Power Automate can connect Dynamics 365 Sales, email, and other applications to automate processes that would otherwise require manual work or custom development.
* This transcript summary has been generated from the Fast Class video by Microsoft Copilot. The Fast Class itself was prepared and taught by Syvantis expert consultants.
TUNE INTO THE LIVE CLASS
Ask your questions and get real-time responses from your trusted Syvantis consultants.
What's on the schedule?
Dynamics 365 Business Central
Dynamics 365 Sales (CRM)
Dynamics 365 Customer Insights
Power Platform
Keep learning...
Business Process Designers. Technical Experts. Dedicated Partners.