Read the screenplay: FANNIEGATE — $7 trillion. 17 years. The biggest fraud in American capital markets.
#4🔄 FlowsPainful

Hardcoded Record IDs in Flows: The Sandbox Surprise

Hardcoded a Record Type ID in a flow. Deployed to production. Different ID. Everything broke.

What Happened

I had a flow that assigned a specific Record Type to new Cases. I grabbed the Record Type ID from sandbox and hardcoded it in an Assignment element. Deployed to production via change set. The Record Type existed in production but with a completely different ID. Every new Case got assigned to nothing. Took me two days to figure out why Cases were missing their Record Type because the flow wasn't throwing errors — it was just silently assigning an ID that didn't match anything.

The Wrong Way

// Assignment Element in Flow:
// Set {!newCase.RecordTypeId} = "0125f000000ABC1AAA"
//
// This ID is from SANDBOX.
// Production has the same Record Type but the
// ID is "0121g000000XYZ2BBB".
// Silent failure. No error. Just wrong data.

The Right Way

// Get Records Element (before the assignment):
// Object: RecordType
// Filter: SObjectType = "Case"
//   AND DeveloperName = "Support_Case"
// Store in: {!supportRecordType}
//
// Assignment Element:
// Set {!newCase.RecordTypeId} = {!supportRecordType.Id}
//
// Now it works in ANY org. Sandbox, prod,
// scratch org, doesn't matter.

The Lesson

Never hardcode Salesforce IDs anywhere. Not in flows, not in Apex, not in formulas. Query by DeveloperName or use Custom Metadata. IDs are org-specific.

Don't make this mistake.

Hire someone who already did.

View Consulting →

Enjoyed this? Get more like it.

Glen's Musings — AI, investing, and building things. Occasional. Free.

More Flows Mistakes