FormulaInstance Class

Contains a method to evaluate the formula instance.

FormulaEval

The context type in the withType method must be a global, user-defined Apex class. Any fields or properties that the formula references must also be global.

The following are methods for FormulaInstance.

Calculates the formula expression and returns the formula output.

public Object evaluate(Object contextObject)

  • contextObject: Type: Object An instance of the Apex class as generated with the FormulaBuilder.builder() method.

Type:

Object Apex type that corresponds to the Apex class as configured by the withType() method in the FormulaBuilder class.

Returns a set of strings that denote the field names referenced in a formula.

public Set<String> getReferencedFields()

Type: Set<String>

A formula is built and evaluated in the context of the current namespace of the subscriber org. If you package a formula that references fields, the fields must be fully qualified with the namespace name.