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
SDMSDM 

I've updated opportunity records in a batch class.I called the batch class from a class.Can I pass the updated record values back to the class from which I called the batch class?

Best Answer chosen by SDM
Alexander TsitsuraAlexander Tsitsura
Hi SDM,

No, it's impossible, apex Batch it's async job.

Thanks,
Alex

All Answers

Alexander TsitsuraAlexander Tsitsura
Hi SDM,

No, it's impossible, apex Batch it's async job.

Thanks,
Alex
This was selected as the best answer
Alexander TsitsuraAlexander Tsitsura
I have a bad idea. You can create new sobject JobResult with fields: Apex_Batch_Job_ID, UpdatedRecordsId. When you run batch, remember job id, and create new JobResult with this job id. In batch you can query this record and update UpdatedRecordsId fields. But this is bad idea. Maybe you have problem with architecture.

Thanks,
Alex
SDMSDM
Thanks Alex