function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Suraj MakandarSuraj Makandar 

How to call a batch class from another class which creates separate transaction for each call

I have a method "processResults(<Campaign ID>)" which calls batch class for bulk processing, which does API callout and after callout it does DML operation.

Now I want to call this method using scheduler (every week) to process camapigns in the org and pass camapaign Id for each call.

How I can achieve this?

A. I can not use batch class, as it will throw "Asyncexception."
B. I can not call this method twice in same trasaction as it will throw "Uncommited work pending exception".