So how to pass sObject to future methods, even when we know that the future methods do not accept the sobjects. So how do we do it?
We will use the JSON methods to first serialize the list of account which will be serialized as string. This string is passed to the future method and then in the future method we will de-serialize the string back to list of account and insert the accounts.
Here’s the code;
This is the main class, we will call it GenerateJson
We will create another class with a future method. We will name the class DeserializeJsonRecords
To check if the code works just run the below line in the developer console
One of the catch here is if the size of the list is very huge then there are chances that the heap size limit will be reached. Also I am not sure about…
View original post 17 more words