I have a trigger which run on insert of a parent record. The working for trigger is like when parent is inserted all the child related to parent get inserted and when child get inserted all the grand child get inserted, it goes till level 4. After all the records get inserted it me result up to 500 to 1000 records get inserted in a single transition. My trigger in recursive so around 50 SOQL getting executed. To break this trigger we stop the trigger to level 2, i.e when parent and child get inserted stop the trigger and do not insert grand child or grand grand child. we are creating parent from VF page so after the parent and child is getting inserted one transition and on a button click update a field on child records and it will generate all the grand child and its child. For overcoming the issue of limit we are making 4 different remote action from VF page. From @remoteaction we are making a call to @future method.

My question is:

  1. Do we need to have call to @future method or we need to have all the code in @remoteaction itself?
  2. Does @future method make any difference?`
  • as per @SamuelDeRycke - this should be approached as a Separation of Concerns problem as the functionality you require needs to execute regardless of how the SObject gets inserted -- VF, AJAX, webservices, REST, Data Loader, Process Builder, etc. Solution needs to be bulkified
    – cropredy
    Oct 14, 2015 at 17:01

1 Answer 1


In a visualforce context each remote action will have it's own static, execution context. So in that regard you don't need to use @future.

You could however use it to:

  • have your remote action finish faster.
  • Increased limits.

However, I'd definitely consider :

  • Triggers and executing something from VF is not the same. Are you sure you do not need this functionality when data is inserted through integration or data-loader/wizard loads ?
  • Have you considered Queueable Apex ? You can chain jobs and so separate you execution contexts too.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .