Sub topic 11
Handling actions with no one-to-one equivalent
This chapter assumes you can read a Workflow Rule or Process Builder process, build a basic record-triggered flow, and have mapped the common actions (field updates, email alerts, tasks, record creation). Here you handle what is left over: actions Flow does not offer directly, or offers with different behavior.
Sort the leftovers first
Most actions map cleanly. Before you design anything custom, sort every action in your inventory into one of three groups.
| Group | Examples | What you do |
|---|---|---|
| Direct equivalent | Email alert, task, create record, post to Chatter, submit for approval, launch a flow, call another process | Rebuild with the matching Flow element or action |
| Equivalent with different behavior | Cross-object field update, task assignment by role, re-evaluation of rules after a field update | Rebuild, then retest the behavior |
| No equivalent | Outbound message | Replace with a platform event, a callout, or Apex |
Outbound messages
An outbound message is a Workflow Rule action that sends a SOAP message to an endpoint. Process Builder never had this action, and Flow has no outbound message element. You have four options.
- Platform event. The flow creates a platform event record with a Create Records element. External systems subscribe through the Pub/Sub API or CometD. This decouples the systems and works well when you control the subscriber.
- HTTP callout action in Flow. If your org has it, call the endpoint straight from the flow. Check your release notes, and remember that callouts in a transaction have restrictions, covered below.
- Invocable Apex that makes the callout. Use this when you need custom headers, retries, or a payload shape the declarative option cannot produce.
- Leave the Workflow Rule in place for now. Existing rules keep running after end of support, but they get no fixes. Treat this as a short-term step with a retirement date, not as a decision.
The receiver may expect the old SOAP envelope. If you cannot change the receiver, option 3 is usually the only one that reproduces the contract exactly.
Example: an invocable callout
A callout cannot run in the same transaction as pending DML in a record-triggered flow. The class below queues the callout so it runs after the transaction commits. It assumes a Named Credential called Billing_API exists and the endpoint accepts JSON.
public with sharing class SendOpportunityToBilling {
public class Request {
@InvocableVariable(required=true label='Opportunity Id')
public Id opportunityId;
@InvocableVariable(label='Stage Name')
public String stageName;
}
@InvocableMethod(
label='Send Opportunity to Billing'
description='Queues a JSON callout for each opportunity.'
)
public static void send(List<Request> requests) {
List<Map<String, Object>> items = new List<Map<String, Object>>();
for (Request r : requests) {
items.add(new Map<String, Object>{
'id' => r.opportunityId,
'stage' => r.stageName
});
}
System.enqueueJob(new BillingJob(JSON.serialize(items)));
}
private class BillingJob implements Queueable, Database.AllowsCallouts {
private final String body;
BillingJob(String body) {
this.body = body;
}
public void execute(QueueableContext context) {
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Billing_API/opportunities');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setBody(body);
HttpResponse res = new Http().send(req);
if (res.getStatusCode() >= 300) {
System.debug(LoggingLevel.ERROR,
'Billing call failed: ' + res.getStatusCode());
}
}
}
}The method takes a list and sends one job for the whole batch. That keeps it bulk-safe: 200 records in one transaction produce one queued job, not 200.
Actions that exist but behave differently
These are the quiet failures. The migrated flow builds and activates, then does something slightly different.
Cross-object field updates
A Workflow Rule can update a parent record's field. In Flow, a before-save flow can only change the triggering record. To change a related record you need an after-save flow with an Update Records element. That element counts toward DML limits, and it can fire the parent's own automation.
Task assignment
A Workflow task could be assigned to a role or to the record creator without extra lookups. In Flow, Create Records needs a concrete user Id in OwnerId. For a role, you first query the User object with Get Records. Decide what happens when no user has that role or several do.
Re-evaluating rules after a field update
A Workflow field update had a checkbox to re-evaluate workflow rules after the change. If an old chain relied on it (rule A updates a field, which makes rule B's criteria true), the chain must now be explicit. Put both steps in one flow, or accept that a flow update can fire other record-triggered flows. The chapter on recursion covers the controls.
Quick actions and approvals
Process Builder could invoke a quick action and submit a record for approval. Flow has both as core actions, but the quick action must already exist on the object, and the approval submission requires a process that the record can enter. Test each one with a record that meets the entry criteria and one that does not.
Invoking Apex from a process
Processes called @InvocableMethod classes. Those classes still work from Flow, but check three things.
- Signature. Processes passed values through the Apex action's input fields. Flow passes the same fields, but a changed label or type needs the flow's action configuration updated.
- Bulk handling. The method receives a list. A method that only reads
requests[0]worked by accident under single-record testing and will lose data in bulk. - Transaction context. A before-save flow cannot call Apex actions. Move any flow that calls Apex to after-save.
Document every decision
For each action you replaced with something different, record the old behavior, the new design, and who approved the change. A short table in your migration notes is enough.
| Old action | New design | Behavior difference | Retest needed |
|---|---|---|---|
| Outbound message to billing | Queueable callout via invocable Apex | No automatic 24-hour retry | Endpoint down, bulk of 200 |
| Task assigned to role | Get Records on User, then Create Records | Fails if no user has the role | No user, two users |
Exercise
A Workflow Rule sends an outbound message when an Opportunity closes. You rebuild it as an after-save flow that calls invocable Apex making an HTTP callout directly in the same transaction. Testing with one record passes, but a bulk update of 200 records fails. Name two likely causes and a fix for each.
Show answer
First, the invocable method may handle only the first request in the list, so it sends one callout and drops the rest. Fix it by looping over the whole list and sending one batched payload. Second, a callout made after DML in the same transaction is not allowed, and a callout per record can exceed the callout limit. Fix it by queueing the callout in a Queueable class that implements Database.AllowsCallouts and sending the batch in one job.