Hi, Guys you can't pass Sobjects as parameters into asynchronous methods. "Methods with the future annotation cannot take sObjects or objects as arguments." You can pass a list or set of ID's and then query for the objects inside the method.
Trigger
trigger test on Book__c (before Update) { if(Trigger.isUpdate){ LIST<String> myOldObjectststId = new LIST<String>(); LIST<String> myNewObjectststId = new LIST<String>(); Set<String> opportunitysalesids = new Set<String> (); for (Book__c b1 : [Select Id from Book__c where id in :Trigger.old]) { myOldObjectststId.add(b1.id); } for (Book__c b2 : [Select Id from Book__c where id in :Trigger.new]) { myNewObjectststId.add(b2.id); } MyObjectUpdateAfter.testMethodFuture(myOldObjectststId ,myNewObjectststId ); } }
Class with Future Method
public class MyObjectUpdateAfter{ @future public static void testMethodFuture(LIST<String> myOldObjectstst,LIST<String> myNewObjectstst){ //Now use these Id of myOldObjectstst & myNewObjectstst } }