New answers tagged

2

When you call any of the asynchronous methods, the memory graph of the object is serialized, and used for all future versions of that call (barring Database.Stateful, which allows the Batchable to modify its internal state, if implemented on the class). For Queueable and Batchable, this doesn't matter, as they only fire once, but Schedulable jobs can repeat. ...


6

This method: global void execute(SchedulableContext SC){ testBatch currentInstanceOfBatch = new testBatch(); Database.executeBatch(currentInstanceOfBatch,currentInstanceOfBatch.batchChunkSize); } executes each time the Schedulable job is executed. At that time, a new instance of testBatch is created, executing its constructor: global testBatch()...


2

The record will show as edited/inserted by the user who was used to schedule the job. So if it's your user that scheduled the job, then your used would show up in the audit fields. With regards to managing permission, it could be done in any of a number of ways. It depends on the use case really. Are these records that should actually never be edited or ...


0

I suggest you do this to troubleshoot. Save your flow as a new flow (not a new version), in the screen dialogue pick autolaunched flow. Create a resource called recordId and mark it as an input variable. Use this variable to get the record and make necessary adjustments to have your flow run without issues. Copy a recordId from within Salesforce, debug your ...


5

This error seems to occur when a batch job is moved to the flex queue. When it enters the flex queue, it tries to acquire a flex queue token. If it fails to receive the token, this error is thrown and the batch job is aborted. Also documented in article: "If the executeBatch call fails to acquire an Apex flex queue lock, the call returns an empty ID, &...


2

Generally to handle errors from batches, you have 2 options: Your Batchable class should implement Database.Stateful interface to maintain a state of instance member variables between separate chunk's transactions. Also, you should create an inner class to capture the context and errors keeping them in a stateful jobErrors field. Example: public with ...


Top 50 recent answers are included