So, I'm trying to access the
Address field on the
User object in an
after update Trigger but I keep getting the error when I try to update a User record.
Invalid field Address for SObject User
I am trying to access the dynamically like so.
u is a User object and
fieldApiName has value
My handler class has API Version 37. My trigger was initially API Version 29, but I updated it to API Version 37. I was hoping that updating the Trigger would resolve the issue but no luck.
I also tried to do it non-dynamically but that doesn't work either.
Oddly when I try it this way and update the User record I get failed recompilation error.
Error: Invalid Data. Review all error messages below to correct your data. Apex trigger UserTriggers caused an unexpected exception, contact your administrator: UserTriggers: execution of AfterUpdate caused by: line 4, column 2: trigger body is invalid and failed recompilation: Dependent class is invalid and needs recompilation: UserHandler: line 92, column 82: Invalid field Address for SObject User
It let me save the code, and when I go to Setup > Develop > Apex Class and click on the
compile all classes link I get no errors. But when I try to update a User record I still get the compilation error.
I would try querying the field via SOQL but I need to get both the new and old values, so SOQL won't help me.