How do I enable asynchronous processing for an object?

In order to enable asynchronous processing, you simply need to open up the Developer Console in Salesforce.  From there, click Debug -> Open Execute Anonymous Window.


Once you have the Execute Anonymous window open, paste in this code snippet, making sure to change ‘Instruction__c’ to the name of the object you would like to process asynchronously (Ex: Contact,  Inventory__c):

Code Snippet


//Set objName to the name of the object where you want to turn asynchronous processing on.


String objName = 'Instruction__c';


rh2__PS_Describe__c d = new rh2__PS_Describe__c(

   rh2__Object__c = objName,

   rh2__Label__c = objName

);

for(rh2__PS_Describe__c e : [SELECT rh2__Asynchronous__c

                            FROM rh2__PS_Describe__c

                            WHERE rh2__Object__c = :objName])

{

   d = e;

}

d.rh2__Asynchronous__c = true;

upsert d;


Once you’ve set objName to the name of your object, click ‘Execute’.  In order to revert to synchronous processing, you can use the same code snippet - just change ‘d.rh2__Asynchronous__c=true;’ to ‘d.rh2__Asynchronous__c=false;’.