Sub topic 12
Using the Migrate to Flow tool and reviewing its output
This chapter assumes you can read a Workflow Rule and a Process Builder process, and that you know the basics of record-triggered flows (entry conditions, before-save and after-save, scheduled paths). You also need a sandbox or Developer Edition org. Run the tool in a sandbox first, even though it does not change your original automation.
What the tool does
Migrate to Flow is a Setup tool that reads an existing Workflow Rule or Process Builder process and creates a new flow from it. It saves you from rebuilding simple automation by hand. It does not replace judgment. Treat its output as a first draft that you review, test, and often reshape.
Key properties of the tool:
- It creates a new flow. The source Workflow Rule or process is left as it was, and it stays active until you deactivate it.
- The new flow is created as a draft (inactive). You choose when to activate it.
- It is available from Setup by searching for "Migrate to Flow".
- It lists Workflow Rules and Process Builder processes that it can convert, and it flags the ones it cannot.
Because both the old automation and the new flow can be active at once, the main risk when using the tool is duplicate firing. Section "Activating without duplicates" covers this.
What it can and cannot convert
The tool supports many common patterns and rejects others. Check the current Salesforce documentation for the exact list in your release, because support has widened over time. The table gives the general picture.
| Source element | Typical result |
|---|---|
| Workflow Rule with field update, email alert, task, or outbound message | Converted when the rule uses supported actions |
| Workflow Rule time-dependent actions | Converted to scheduled paths when supported |
| Process Builder with one criteria node and simple actions | Usually converted |
| Process Builder with several criteria nodes | Often converted, with each node becoming a decision outcome or path |
| Process Builder invoking Apex, a flow, or another process | Support varies. Some are not convertible |
| Actions with no flow equivalent | Not converted. See the chapter on handling gaps |
Rules and processes that the tool does not support are shown as not convertible. You must rebuild those by hand using your inventory and the mapping rules from earlier chapters.
Running a migration
- In your sandbox, open Setup and search for Migrate to Flow.
- Select the Workflow Rule or Process Builder process you want to convert. Start with a simple one to learn the output style.
- Choose Migrate to Flow, then review the generated flow in Flow Builder.
- Read the flow carefully. Fix, rename, and test it.
- Activate the flow and deactivate the original, as one planned step (see below).
Migrate one object's automation at a time. If you convert a single rule from an object that has five rules and three processes, you will end up with several flows on the same object. That is hard to reason about later.
Reviewing the output
Open the draft flow and check each part against the original. Do not assume the tool got it right.
Entry conditions and run frequency
- Confirm that the trigger is the right one: record created, updated, or created or updated. Workflow Rules that ran "only when created" or "every time created or edited" map to different settings.
- Confirm the condition logic. Workflow criteria written as formulas can be translated into formula conditions. Picklist checks need
TEXT()in a flow formula, where a Workflow Rule usedISPICKVAL. - Check "Run the flow" frequency. A Workflow Rule that fired only when the criteria changed from false to true needs the setting "Only when a record is updated to meet the condition requirements". A process that evaluated the criteria every time needs "Every time a record is updated and meets the condition requirements". A wrong setting is a common cause of missed or repeated actions.
- Look for
ISCHANGEDorPRIORVALUEin the source. These have no formula equivalent in flows. The usual replacement compares{!$Record.Field}with{!$Record__Prior.Field}in an update-triggered flow.
Before-save or after-save
The tool often builds the flow to run after the record is saved, even when the only action is a field update on the triggering record. A before-save flow is faster and does not use an extra DML operation. If the original only updated fields on the same record, consider rebuilding it as a before-save flow. Keep it after-save if it creates related records, sends email, or calls Apex.
Actions
Check each generated element:
- Field updates: Verify that the target record and field are right. A Process Builder update of a related record becomes an Update Records element on the related record, which is not the same as updating
$Record. - Email alerts: The flow should reference the existing email alert, with the same template and recipients.
- Tasks and record creation: Check the owner, subject, due date formulas, and any related-to value.
- Scheduled actions: Check that each scheduled path uses the right time source and offset, such as a number of days after the close date.
- Apex and subflow calls: Confirm that parameters are mapped.
Hidden differences
These areas are easy to miss in review:
- Null handling. Workflow and flow formulas treat blank values differently in some cases. Test a record where the field is empty.
- Order of actions. Workflow actions had no guaranteed order. Process Builder ran actions in the sequence of the node. Your flow may now depend on an order that was never promised before.
- Naming. Generated element names are often long or generic. Rename them so the flow can be maintained.
- Description. Add a description that names the original rule or process and the migration date.
Activating without duplicates
If both the original and the flow stay active, every matching save runs both. A field update might happen twice, an email may go out twice, and a task may be created twice. Plan activation so that this overlap is as short as possible.
- Complete testing in the sandbox.
- In production, deploy the inactive flow first.
- In a quiet window, activate the flow and deactivate the original automation in the same change.
- Watch for duplicates, and keep the original available to reactivate for rollback.
Do not delete the original until the flow has run cleanly for an agreed period.
SELECT ApiName, Label, ProcessType, IsActive
FROM FlowDefinitionView
WHERE ProcessType = 'Workflow' AND IsActive = trueRun this query with the Tooling API option checked. It lists the active Process Builder processes, so you can confirm that a migrated process is no longer in the list after cutover.
Common errors
- Migrating one rule at a time without a design. You end up with many flows on one object. Consolidate per object where possible.
- Trusting the generated flow. Always compare behavior, not only the layout.
- Skipping bulk tests. A migrated flow that works for one record can fail on 200. Test with the bulk Apex test from the testing chapter.
- Forgetting the old automation. Leaving both active causes duplicate emails and tasks.
- Ignoring flow warnings. Fix any issue that Flow Builder reports before activating.
Exercises
Exercise
A Workflow Rule updates a field on the same Opportunity when it is created or edited and the criteria are met. The tool produces an after-save flow. Would you keep it as is? Explain.
Show answer
Probably not. If the only action is a field update on the triggering record, rebuild it as a before-save flow. A before-save flow changes the record without an extra DML operation, so it runs faster and uses fewer limits. Keep after-save only if the flow also creates related records, sends email, or calls Apex.
Exercise
After activating a migrated flow in production, users receive two identical emails for each qualifying update. What is the likely cause, and what do you do?
Show answer
The original Workflow Rule or process is still active alongside the new flow, so both send the email. Deactivate the original automation. Then confirm with the FlowDefinitionView query, or the Workflow Rules list in Setup, that only the flow remains active. Plan future cutovers so activation and deactivation happen in the same change.
Exercise
The source Workflow Rule fired only when a record changed from not meeting the criteria to meeting them. Which run frequency setting should the flow use, and why?
Show answer
Use "Only when a record is updated to meet the condition requirements". This setting runs the flow on the transition into the criteria, as the Workflow Rule did. "Every time a record is updated and meets the condition requirements" would run the flow on every later save while the criteria still hold.