You need to sign in to do that
Don't have an account?
Lee Yakiwchuk
Unable to access Address compound field on Lead object in Apex trigger.
This link:
https://help.salesforce.com/apex/HTViewSolution?urlname=Spring-15-Access-Address-and-Geolocation-Compound-Fields-Using-Apex&language=en_US
says I can access Address compound fields from Apex. I can access Account address fields but on Leads I get the error "Invalid field Address for SObject Lead". This error when my trigger runs. There is no error in the Developer console. Not sure if this is by design or if I amdoing something wrong.
I have tried just referencing the field, assigning the field to an Address type field, and looking it up in a SOQL query. I can look the field up in the Execute Anonymous console and it works fine.
Any idea what I am doing wrong?
Thanks!!
https://help.salesforce.com/apex/HTViewSolution?urlname=Spring-15-Access-Address-and-Geolocation-Compound-Fields-Using-Apex&language=en_US
says I can access Address compound fields from Apex. I can access Account address fields but on Leads I get the error "Invalid field Address for SObject Lead". This error when my trigger runs. There is no error in the Developer console. Not sure if this is by design or if I amdoing something wrong.
I have tried just referencing the field, assigning the field to an Address type field, and looking it up in a SOQL query. I can look the field up in the Execute Anonymous console and it works fine.
Any idea what I am doing wrong?
Thanks!!
I am able to access the lead address field in the trigger. Not sure what might be causing you the problem, however you might want to check the version of the class/trigger. I get the above error for versions below 30.
For testing purpose, i used below code and it worked fine. Ofcourse, it is not correct code, but it was just for checking if i am able to access the Address field in the trigger: Thanks,
Shailesh.
I have very similar code and I also do not get an error when saving. However, when the trigger runs( when I update a lead), it gives the error "Invalid field Address for SObject Lead". If you are able to update a lead without error, I think I probably need to open a ticket with SF support.
Thanks!!
Lee
Its a standard layout. SalesForce support is looking into it. So we'll see what they come up with and I'll post it back here.
Thanks!
Lee