2

I have a test class that iterates through a bunch of "educational programs my company offers" and makes sure that each program is properly embedded in our org's schema.

(I've got a utility class that stores the API names, picklist strings, etc. to expect - the test class makes sure that the "expected" values are actually there.)

I'd like to add a test to ensure that a certain string representing each program appears in the definition of a given formula field. I always forget to update that formula field when we offer a new program.

Is there a way to use Apex to fetch a textual representation of a formula field's formula?


[Note - this is NOT about recomputing the value. This is about inspecting the code behind the formula. Not a duplicate to .recalculateFormulas() questions.]

0

1 Answer 1

1

Looks like the DescribeFieldResult class has a method named .getCalculatedFormula().

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .