I have gone through at least 10 sites explaining the use of this. What I cannot ascertain is if I simply want to try something and if it fails, go on (don't need to do anything with the error). I have some fields where each one exists "per product" as needed (or not). At the top of the routine, I would like to do a simplistic:
try{ accObj.put('PB_Stage_UTP_OnDemand__c','testtttttt'); } catch( Exception exx ){ }
Is this "acceptable"? It tests fine. Do I HAVE to do anything with the Exception result?
hasFieldXYZ
;) Describe() call on each sounds like an overkill... But from "philosophical" point of view are you 100% sure it's ok to "just try" without checking if field exists andisUpdateable()
by current user? I'd prefer some runtime checks along linesinstanceOf
etc to be honest.