You need to sign in to do that
Don't have an account?
pavan kumar 1864
Formula field not accesible in Test Class
Hi, i have put up a condition in class using Formula Field and now in the test class i want to use it For unit Testing,If i give the value to Formula Filed the Error is popping up as this is NON- WRITTEABLE...what is the workaroud for this
Hi pavan,
You your formula filed is like
formula name Total
field Name1: Data1
field Name2: Data2
Formula
Total=Data1+Data2;
so you need to fill the value of Data1 and Data2 in test class after that it automatically calculated in Total
No need to assign value in total
Thanks Please mark it as the Best Answer
Thank You
All Answers
Hi pavan,
You your formula filed is like
formula name Total
field Name1: Data1
field Name2: Data2
Formula
Total=Data1+Data2;
so you need to fill the value of Data1 and Data2 in test class after that it automatically calculated in Total
No need to assign value in total
Thanks Please mark it as the Best Answer
Thank You
I think you are trying to populate formula field in testClass, please note it will populate automatically.
check this link
https://salesforce.stackexchange.com/questions/198345/field-is-not-writeable
If you need to acess formulaField in test class you need to re query it.
https://stackoverflow.com/questions/36718501/salesforce-formula-field-always-equals-null-in-apex-code
https://salesforce.stackexchange.com/questions/129500/formula-field-is-not-getting-executed-in-test-class
If it helps, please mark this as best answer.
Thanks!