You need to sign in to do that
Don't have an account?
Vj@88
Formula fields evaluation in Test classes
Hi,
I wrote some apex code that will based on the result of a formula field. It works fine with real data.
But the problem is when I try to generate mock data in test class, the formula field is not evaluating and is always 'Null'.
Can annybody help me how to get the formula field evaluated?
I wrote some apex code that will based on the result of a formula field. It works fine with real data.
But the problem is when I try to generate mock data in test class, the formula field is not evaluating and is always 'Null'.
Can annybody help me how to get the formula field evaluated?
Account theAcc = [SELECT ID, Region__c FROM Account WHERE ID-: A[0].id limit 1];
Then you should be able to access "theAcc.Region__c".
All Answers
Region__c is a formula field on Acount that copies the region of the Account Owner User.
Now this is what I got in debug logs. A null value
Account theAcc = [SELECT ID, Region__c FROM Account WHERE ID-: A[0].id limit 1];
Then you should be able to access "theAcc.Region__c".