There's a line in The Matrix that goes something like: "Nobody cares how it works, as long as it works." Too often that's how Salesforce gets built. Teams face tight deadlines, or don't have the experience to think through how the back end should be designed to grow.
Salesforce becomes the backbone of your business, and the way your business works today will almost certainly be different a few years from now. So how do you build a system that bends when the business changes, instead of breaking or waiting on a developer?
Custom metadata is your best friend
Let's take a simple requirement: if an opportunity has been open for 90 days, close it automatically. We'll build it with Flow.
We need a scheduled flow that runs daily and finds opportunities that have hit the threshold. To make that easy, we add a formula checkbox on Opportunity that says whether the opportunity is due to be closed:
isTriggerOpportunityClosure_f__c (Formula, Checkbox)
NOT( IsClosed ) &&
DATEVALUE( CreatedDate ) + 90 <= TODAY()Then the scheduled flow, Opportunity [SF] - Close Opportunity, runs daily on Opportunity with one start condition: isTriggerOpportunityClosure_f__c equals True. Its only step is an Update Records element that closes the opportunity.
A small fix worth making: a formula that checks for exactly day 90 (= TODAY()) misses any opportunity the flow doesn't catch on that exact day, for example if the job doesn't run. Using <= plus NOT( IsClosed ) catches everything past the threshold and skips deals that are already closed.
The requirements always change
Six months later, the business decides 90 days is too long: close them after 60. With the number hard-coded in the formula, someone has to find the field, remember how the automation works, edit the formula, and test it. That's a small project for a one-number change.
Now imagine the number of days lives in a setting instead. Create a custom metadata type called Opportunity Setting (OpportunitySetting__mdt) with one number field, Number of Days to Close Opportunity (NumberOfDaysToCloseOpportunity__c). Add a record named Opportunity and set it to 60.
Then point the formula at the setting instead of a hard-coded number:
isTriggerOpportunityClosure_f__c (Formula, Checkbox)
NOT( IsClosed ) &&
DATEVALUE( CreatedDate )
+ $CustomMetadata.OpportunitySetting__mdt.Opportunity.NumberOfDaysToCloseOpportunity__c
<= TODAY()From now on, changing the rule means editing one value in Setup: Custom Metadata Types → Opportunity Setting → Manage → Opportunity. No formula edits, no flow changes, no deployment.
Why this matters
- Changes take minutes, not weeks. When the business needs a change right away, anyone with the right access can make it.
- You don't need a developer. Your own admin, or even a business owner, can adjust how the automation behaves.
- The rules are visible. Business rules live in one readable place, instead of being buried inside formulas and flows.
- It deploys cleanly. Custom metadata records move between sandboxes and production with the rest of your configuration.
You can take this idea a long way, with settings that control almost all of your automation: thresholds, stages, owners, notification recipients, and which features are switched on. That's how we build every Campfire accelerator, so our clients can run and change their Salesforce themselves, with no vendor lock-in. See why we build this way.
