3

If I create a field on the grandparent, then create a formula on the parent that displays the grandparent field value on the parent, is there a difference between:

A) Creating a formula on the child that points to parent's formula (that points to the grandparent's field)

or

B) Creating a formula on the child that points directly to the grandparent's field?

Obviously, both options are functionally equivalent, but I'm wondering if there are advantages to one approach over the other. One advantage of option B is that we can delete the parent formula field and the child formula still works. Is there anything else?

Thanks,

-Philip

5

Using a formula in another formula increases the dependent's formula compiled size by the original formula's compiled size plus some additional overhead every time you use it. For simple formulas, this may not matter, but keep in mind that complicated formulas will fail to compile sooner when it has to evaluate another formula repeatedly. Additionally, in case it matters, keep in mind that the first option is using two fields, and the number of fields you can have per object is limited. Overall, there is never a point where option A is better than option B, but there are situations where it doesn't matter.

| improve this answer | |
  • There is an advantage: by not using a formula inside another formula, you won't create a dependency, and you will be able to delete the first without worrying about the second. Not much of an advantage... but there isn't really other thing to consider, I think. – Renato Oliveira May 28 '17 at 3:20
  • @RenatoOliveira That's still an advantage for B. A never has an advantage. – sfdcfox May 28 '17 at 3:40
1

Option B is good.

Salesforce provides an option to reach up to 5 levels for querying relationship objects.

So, it will be better to directly access Grand Parent record, if you really need that as Formula evaluates on the fly. So, evaluating one by one relationship object level formulas could be costly in terms of performance.

If you are really dependent on parent object's formula rather than moving to Grand Parent object, then you can go one by one level up.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.