Activity Forums Salesforce® Discussions Salesforce - While passing the parameter in Future method, why can we only pass Primitive type parameter?

  • shariq

    Member
    July 12, 2017 at 1:44 pm

    Hello Parv,

    The reason why sObjects can’t be passed as arguments to future methods is because the sObject might change between the time you call the method and the time it executes. In this case, the future method will get the old sObject values and might overwrite them. To work with sObjects that already exist in the database, pass the sObject ID instead (or collection of IDs) and use the ID to perform a query for the most up-to-date record.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos