We’ve spoken before about how dependencies between objects are the most common cause of failed deployments. There are a host of different dependency types, and failing to notice that one object is dependent on another when building a deployment package is likely to cause your deployment to fail.
Thankfully, Gearset’s dependency tracking is here to help. Gearset checks for dependencies before pushing the deployment package up to Salesforce and warns you of any that are missing. Our goal is to eliminate the trial-and-error from deployment - when you click the “Deploy” button in Gearset, we want you to be confident that the deployment will succeed.
Although we don’t currently detect all types of dependency, we’ve been steadily increasing our coverage over the past 12 months guided by our telemetry and, most importantly, feedback from you. Our most recent addition is detecting dependencies in formula fields.
Field Discount_Approved__c
does not exist. Check spelling
Consider the following formula that adds an “Amount After Discount” checkbox to opportunity:IF(Discount_Approved__c, ROUND(Amount - (Amount * Discount_Percent__c), 2), Amount)
To create this formula, we’ll also need to add the custom fields Discount_Approved__c
and Discount_Percent__c
. If we were then to naively deploy our new “Amount After Discount” field, the deployment would fail validation:

That’s to be expected - this formula depends on Discount_Approved__c
and Discount_Percent__c
and they were missing from our deployment package. At this point, you’d ordinarily go back and add the missing custom field to your deployment package and try again. To make matters worse, Salesforce will only report the first missing dependency it encounters in a formula field, so once you’ve added Discount_Approved__c
, the validation will fail again, reporting that Discount_Percent__c
is missing. Even in this simple case, you might have two false starts before you build a successful deployment package.
How Gearset helps
With formula dependency tracking, Gearset can help in two ways. Firstly, expanding the tree node for Amount_After_Discount__c
will show that the field has the two dependencies above:

Clicking the checkbox next to “Depends on” will include the dependencies in your deployment package.
Secondly, as with all of Gearset’s dependency analysis, we’ll check whether there are any missing dependencies and warn you before passing the deployment package to Salesforce:

This makes it trivial to discover and include dependencies without having to go through the round trip of pushing the package to Salesforce and receiving an error.
If you’ve already seen enough, then go ahead and give it a go - just head over to https://app.gearset.com and start your free 30 day trial! If you’re curious about the details, read on.
Finding dependencies in formula fields
The above is quite a simple example, but formulae can get quite complicated. There are several steps required to figure out what a formula actually depends on:
- Parse the formula and extract the names of objects and fields
- Translate references to objects into the underlying object types
- Use the result of the above to build the list of dependencies
In the most extreme cases, formulae can contain references to fields like:CustomObjectReference__r.StandardObjectReference.AnotherCustomObjectReference__r.StandardField
This is deceptively tricky to untangle! Assuming the above is extracted from a formula field on the Account
object, the actual dependencies would be:
Account.CustomObjectReference__c
← a custom field onAccount
, indicated byCustomObjectReference__r
CustomObject__c
← The underlying object referenced byCustomObjectReference__c
, because we refer to a standard field on itStandardObject.AnotherCustomObjectReference__c
← the custom field on the object referenced byStandardObjectReference
AnotherCustomObject__c
← the underlying object referenced byStandardObject.AnotherCustomObjectReference__c
This, of course, just scratches the surface of the complexity - we’ve not even mentioned:
VLOOKUP
- multi-type lookup fields (
Owner:Queue
,Owner:User
) - built-in standard object references (what does
Parent
refer to for different built-in types?)
...and so on. Needless to say, figuring out these dependencies by hand or by trial and error can be really time consuming. Now you can let Gearset do the heavy lifting for you! See how Gearset handles complex metadata dependencies for yourself with a 30-day free trial.