You need to sign in to do that
Don't have an account?

Is it possible to create an AddressHandler ?
version 47
We've several objects, both std and custom, that contain Address compound fields. I'd like to create an AddressHandler, similar to ContactHandler, to apply various corrections to an Address regardless of which object it is tied to. Is this possible? I can reference System.Address in my Apex but there are no setters to go with the getters (!???!) Or must I put boilerplate into ContactHandler, AccountHandler, LeadHandler and all the other Handlers for objects with one or more Address compound field? Surely there's a better way.
We've several objects, both std and custom, that contain Address compound fields. I'd like to create an AddressHandler, similar to ContactHandler, to apply various corrections to an Address regardless of which object it is tied to. Is this possible? I can reference System.Address in my Apex but there are no setters to go with the getters (!???!) Or must I put boilerplate into ContactHandler, AccountHandler, LeadHandler and all the other Handlers for objects with one or more Address compound field? Surely there's a better way.
I can create
where my ContactHandler.afterInsert() is calling this method
now here (https://developer.salesforce.com/blogs/developer-relations/2012/05/passing-parameters-by-reference-and-by-value-in-apex.html) it says Apex sObjects are pass-by-reference - great, that's the behavior I want. And here (https://developer.salesforce.com/docs/atlas.en-us.object_reference.meta/object_reference/compound_fields_limitations.htm) it talks about compound-field uses and limitiations where there's an example of setting a specific field value . So this should be doable, I just can't seem to get the syntax right.
If I can't do an update on the compound field , I could change the function to return a boolean then adjust afterInsert like so
Any ideas?