My process I've been working on hits CPU time limit exception errors sometimes. So instead of using a batch process, I want to try to use @future methods to put some of the DML statements in the future asynchronously. I have two methods one creates a related record and one updates a record based on the related record.
Can I write something like this:
@future
public static void futureFolk(Set<Id> filtered)
{
handlerclass.createRecord(filtered);
handlerclass.updateRecord(filtered);
}
}
Because one is based off the other I don't want to do two @future methods because one may not be finished by the time it starts. I also, want to try and seporate the concerns so I can test better so I don't think I should combine them into one giant method that inserts and updates records.
Is there a right way to do this?
If I don't use @future the records will get inserted and updated so I think that my base logic is right, just I need help with getting the order right for both to be done in the future.