I want to do a bulk update of records in parallel, but Batch Apex doesn't permit this.
I was wondering if the following solution would work:
- I have an SObject defined that holds a value for the query, limit & offset values.
- I split a job up according to a max say 1000 records and the correct offset and I add these values one at a time to the above table, which fires a trigger that calls an @future method.
- The @future method does all the processing.
Now the question I have is –
- Does the above scenario violate the @future invocation limit of 10 from the calling code? i.e. Does the trigger callout count towards the limit in the apex calling the insert record.
thanks
Best Answer
Well first let me clarify if i understand your idea right:
No, This will not work!
Why?
You can not call future method from another feature method in your case you are calling trigger and that is calling future method.
It will fail at second iteration as it will realize that you are calling future from future.
Best option is follow the advise given by cropredy in comment