function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Formula Fields Not Evaluating when Running testmethod



I have an issue where I have conditional logic in a trigger that is based on the value of a formula field.  When running a functional test in the UI, this formula field evaluates fine and the trigger logic proceeds as expected.  When I run a testmethod with the same use case, the formula field does not evaluate and a bunch of code doesn't get covered.  


This is happening in two separate places in two different orgs.  I also have the debug logs to prove the formula field is getting evaluated in the functional test and not getting evaluated in the testmethod.


Has anyone ever run into this issue?  If so, how do you get around it without rewriting the trigger to mimic the formula field logic?


Thanks very much for any input!

Echo, did you every find an answer to this issue? I'm running into the same problem

I am having the same problem. Have either of you figured it out?


Any update or ideas?  I am having the same issue.