Welcome to this stop on my XrmToolBox Tool Tour. Here we’ll visit Bulk Workflow Execution, a tried-and-true workhorse from the earliest days of XTB.


What Is Bulk Workflow Execution?

Bulk Workflow Execution executes classic workflows against a set of records filtered with a view or FetchXML query. The last release date was in 2017, as the version number suggests. Soon after, Microsoft launched Power Automate (formerly known as Flow) to create automated flows and replace their older cousins, the workflows. 

However, they both live on together with no published end-of-life for the originals. Until then, and as long as the classic versions run, this tool is indispensable to system administrators.

Version: 1.2017.7.21 (at the time of review)

Author: Andy Popkin

XrmToolBox: https://www.xrmtoolbox.com/plugins/AndyPopkin.BulkWorkflowExecution/

GitHub: https://github.com/andypopkin/XrmToolBox---Bulk-Workflow-Execution

How Do You Use Bulk Workflow Execution?

NOTE: Please remember to follow your organization’s testing and updating policies before starting workflows from the Bulk Workflow Execution tool. It’s always a good practice to backup the environment or export the view records before starting.

First, let’s take a tour of the command ribbon and sections.

A. Close

The red "X" is NOT the stop button. It closes the tab and the tool.

B. Refresh

Resets both the lists of workflows and views together, or choose them individually by clicking the dropdown arrow (▼).

C. Validate Query

Check the FetchXML logic and count the records. You must click this button to activate the "Start Workflows" button. In case you were wondering, the icon is an abacus since it counts the records.

D. Start Workflows

Initiate the selected workflow against the validated record query.

E. Stop

Cease applying the workflow to unprocessed records. This button can’t stop workflows that are in progress in the system.

F. Help

Displays a brief set of instructions, basic information, and Andy’s contact info in the FetchXML Query window.

G. Edit in FetchXML Builder

Appears when the "Select a Source Type" option is set to "Use Custom FetchXML Query" (see below). Click this button to launch the FetchXML Builder tool in a new tab (more on that one in another blog).

H. Select an On-Demand Workflow

Select the workflow you want to apply to your records. Only on-demand workflows will appear. If you created a new workflow since opening the tool, click the Refresh button (see above).

I. View

Select a view to filter the records to which you’ll apply the chosen workflow. Only those associated with the same table as the workflow will appear. System views will appear at the top and personal ones below.

The Select a Source Type defaults to Use CRM View FetchXML Query. If you want to edit an existing view, select it first, and then change the source type to Use Custom FetchXML Query. Edit directly in the FetchXML Query pane (see below) or click the Edit Query in FetchXML Builder button (see above).

J. Info

Shows the number of records returned from the FetchXML query after clicking the Validate Query button (see above). The progress bar will fill with green as the tool applies the workflow to each record.

You can adjust the Batch Size and Interval Delay here. The suggested settings appear by default, but you shouldn’t need to change these values unless you experience time-out errors.

K. FetchXML Query

This section displays the FetchXML query code used to filter records in the selected view.

When "Select a Source Type" is set to "Use CRM View FetchXML Query," the query is read-only. To edit in this pane, change "Select a Source Type" to "Use Custom FetchXML Query."

Now that you understand the controls and sections, you’re ready to execute your workflows in bulk.

1. Click Refresh to ensure that your option sets are current.

2. Select a workflow.

3. Select a Source Type and choose your view.

4. If you’re using a custom query or want to edit an existing one, change Select a Source Type to Use Custom FetchXML Query. Then, (1) edit it directly or (2) click the Edit Query in FetchXML Builder button.

5. Click the Validate Query button. Address any errors in your query, and click again.

6. Once you’re sure you want to begin applying the workflow to the records, click the Start Workflows button.

7. The progress bar will fill from left to right as the tool applies the workflow to the records. A separate progress window will appear with a counter and an estimate of the time remaining to complete the process.

8. If you need to stop the process, click the Stop button. This step will prevent the tool from applying the workflow to any additional records; however, it does NOT end the in-progress workflow processes.

9. When the tool has completed applying the workflow to the records, you’ll see a pop-up window showing when the process finished and the number of workflows started.

10. The tool’s end is only the beginning of the system’s work because it continues to process the workflows in real-time (synchronously) or in the background (asynchronously) based on the workflow.

When Do You Use Bulk Workflow Execution?

If you have a classic workflow to run against a large set of records, the Bulk Workflow Execution tool fills the need.

Microsoft limits the total number of records to a maximum of 250 per page in a view. Without this tool, you would have to select and apply the workflow at least four times for 1000 records. Now, imagine that for 10,000, what about 100,000? You can see its value in terms of your time and repetitive-use injury to your mouse-clicking finger.

Nevertheless, keep in mind these limitations:

  • It works with classic workflows only, not Power Automate flows.
  • It works with on-demand workflows only. They can be synchronous (real-time) or asynchronous (background).
  • You can isolate the records using various options: using existing views in the environment, customizing them within the tool, or leveraging the FetchXML Builder integration.
  • Generally, it takes about two seconds per record to apply the workflow, so 10,000 will take approximately five and a half hours. Plan accordingly. Fortunately, you don’t have to monitor it closely since it runs automatically. Still, I recommend the occasional check-in for time-out errors.
  • That time estimation (5.5hrs) does not include the time to execute the workflow. The execution will depend on the type of workflow, its complexity, and available system resources.

What Issues Might You Experience Using Bulk Workflow Execution?

Occasionally, you’ll see errors related to the batch size. As Dynamics 365 matures in the cloud and Microsoft refines the call limits, you may need to reduce the size and introduce an interval delay.

You can also combat these issues by adjusting your query to include fewer records at a time. For example, you can add a starts with an “A” filter to the Account name or Opportunities created in the last X years.

There’s no one-size-fits-all guide since each dataset is unique.

What New Features Might Help You?

This tool is well seasoned and works error-free. Those time-out errors you may experience stem from call and system limitations.

With no updates since 2017 and the advent of Power Automate, it’s safe to assume that Andy is not developing new features.

Thanks for joining me on this leg of the XrmToolBox Tool Tour. Stay tuned for the next stops on our journey. If you find yourself needing support, let us know by contacting C5 Insight.