So I am trying to deploy a changeset and in one of the tests I am referencing the PersonMailingAddress
with the following query:
[Select Id, PersonMailingAddress From Account Where Name Like '%Test%'];
The deployment fails saying there is no such field on account.
So I modified the code (not like this but to represent)
try{
....Do Query Here....
}catch(Exception e){
system.debug(e.getMessage());
}
Now it deploys and during deployment the error message is output to the debug log.
The weird part is that when I run the test after deployment I DO NOT get an error message and the test never enters the catch block...
I added the catch solely to be able to deploy.
Any insight on why that field is not found on the account sObject during deploy only but is present before and after via query, code, and as proven by the test method ran after deploy not throwing an error? Same user is deploying in all cases.
Just in case it could be part of the issue, code is being deployed when logged into client org via the LMA.
Again to clarify, Only during deployment does the system throw an error that PersonMailingAddress
is not found on the Account sObject. The exact same test passes fine after deployment. No changes are made to the profile, permissions, fields etc during deployment. In fact, to validate no permissions were altered, after the successful deployment, a subsequent deployment of the code with the try catch removed still throws the error.
Curious to know if anyone has ran into this before?