You need to sign in to do that
Don't have an account?
Sam Kamensky
If I pass an sObject as a parameter to a method, which fields will be available?
I think my two options are pass the id to a class and query the fields I need there, or, pass the entire sObject and do no querying.
Assuming that the sObject will always come from a trigger (as I understand it no querying is needed when using trigger.new as it automatically contains the entire sObject), do I ever need to query again? Or can I simply pass the sObject I get from the trigger to any and every class I want?
Assuming that the sObject will always come from a trigger (as I understand it no querying is needed when using trigger.new as it automatically contains the entire sObject), do I ever need to query again? Or can I simply pass the sObject I get from the trigger to any and every class I want?
All Answers
when you wil pass entire sobject(assuming it is comming form trigger), no need query, all the field for that object will be accssible in the method.
if i have a trigger on account object and passed the list of records to method then inside method without querying i can access all the fields of the object.
Thanks,
Debasis
If answer helps you please select as best answer so that it will be easily refer in future by anyone.