Using Dynamics365 & Power Automate to Transfer Existing Records from Old to New Business Process Flow

19 May, 2021 | 3 minutes read

Business process flow or shorter BPF is one of the key components provided by Dynamis365. BPF represents a custom entity and an instance of a process that is stored as a record within that entity.

With business process flows you can define stages and steps, which are afterward displayed on the heading across the top of the form. The beauty of using a process is that you can move between the records of the related entity.

However, sometimes we might need to change the default BPF with a new one. Our blog post will cover moving all existing records programmatically from the old BPF to the new BPF by using Power Automate Flow.  

Let’s take a closer look!

The first thing that you should do is create and activate a new process. After that, we come to the main part. Now we have existing records following the default Lead To Opportunity Sales Proces.

If we are creating a new Lead we have Custom Lead to Opportunity Process. So we have records with different BPF.

This is the expected behavior of the system, but what about the old Lead records? What do we do with the data we already have in the system and it’s following the standard process? Can we transfer the already-created records into a new table?

We can do that by using an out-of-the-box solution.

Open Lead and navigate to Process button > Switch Processes and select new BPF. Then Save this record and Close.

But Dynamics365’s out-of-the-box solution does not fully meet our requirements.

Dynamics 365 allows us to switch processes per record. Thus if you have several thousand data records, that would be a big problem.

Our solution

We have created an automated solution that with one click transfers the data from the old table to the new one, and deletes the old ones in the same flow.

This is how the solution works:

  1. Open Power Automate and build an instant cloud flow with a Manual trigger
  2. List all records from Lead to Opportunity Sales process (old BPF)
  3. Click Apply to each, and for each item add a new row in Custom Lead to Opportunity process. If we want to make a replication where Name is Lead (value) we have to set leads (Lead (Value)) into Lead (Leads) field.
  4. Finally, delete the record from Lead to Opportunity BPF because we want to avoid the duplicates in our system.

Here is a visual representation of the entire Power Automate flow with the logic for switching between the old BPF and the new.

Conclusion:

Dynamics 365 is an all-in-one platform, which gives you a comprehensive 365 degrees perspective of your business. The most popular services provided by Dynamics are:

  • Sales
  • Marketing
  • Finance
  • Project Service Automation
  • Customer Service
  • Field Service
  • Operations

On the other hand, you can create automated flows to improve productivity with business process automation with Microsoft Power Automate integration.

You can set up automated flows between your favorite Dynamics apps and services, synchronize, get notifications, collect data, and much more.

If you want to learn more about Dynamics 365 and Power Automate, please check out the official Microsoft documentation or if you need expertise in this area contact us, so we can discuss this topic more.