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
CooldayCoolday 

Can we call an Invocable method in batch class execute method?

I have a requirement where I have to call my method (Invocable) inside Batch Execute() method.

Is it possible?

AnkaiahAnkaiah (Salesforce Developers) 
Answer is no.

An InvocableMethod must be static, so you can't not create an instance. You can, however, combine the logic of both in to a single class. 

Refer the below link.

https://salesforce.stackexchange.com/questions/346460/create-invocablemethod-inside-class-that-implemented-batchable-and-invoke-new-i

If this helps, Please mark it as best answer.

Thanks!!