You need to sign in to do that
Don't have an account?
Test class run failing with : System.QueryException: Insufficient permissions: secure query included inaccessible field
Hi,
While running the test class for code coverage, I am facing an issue to run it succesfully as it is throwing the below exception :
System.QueryException: Insufficient permissions: secure query included inaccessible field
My guess is that Test class is run in system mode which does not require permissions for field. (Please correct me if i am wrong)
I had also went through the test class to check if any profile/user is mentioned in the test class and that is not the case.
One thing to note is that, Test class is running sucesfully in one org with good code coverage, but its not running on another org and says it failed due to the above mentioned exception.
Any work around/ Idea to overcome this issue ?
Thank you :)
checked below blog you will get understanting about that exception :
https://www.sfdcstop.com/2020/03/validate-crud-permission-before-soqldml.html
If it helps mark it as best answer.
Thanks!
All Answers
checked below blog you will get understanting about that exception :
https://www.sfdcstop.com/2020/03/validate-crud-permission-before-soqldml.html
If it helps mark it as best answer.
Thanks!
This was the reason why the test class was running in User Mode and checking for the access permissions for the current user.
Thought it was running in System Mode.
Thank you for sharing 👍