Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

New answers tagged

4 votes

Can't delete Apex class from production, deployment fails with "This Batchable class is in use. : Apex Sharing Recalculation", but no job queued?

When I checked the "apex jobs" page, filtering by status, I couldn't see any jobs pending. However, when I queried them with the Developer Console, some rows were showing as "processing&...
Renato Oliveira's user avatar
6 votes

How to make a call out after every DML in batch

The basic answer is "you can't." DMLs block callouts, so if you need this kind of behavior, you have to arrange an alternative solution. I solved this very problem in a different manner once....
sfdcfox's user avatar
  • 493k
3 votes

How to make a call out after every DML in batch

The obvious answer is to invoke a future method or enqueue a Queueable that does the callout. You'd call or enqueue with the required details after each DML in execute. Obviously the future method or ...
Phil W's user avatar
  • 36.6k
1 vote
Accepted

Apex Batch Question

public class censusUploadBatch implements Database.batchable<List<String>>, Database.AllowsCallouts, Database.Stateful{ Is telling Salesforce that you want a list of list of strings, so ...
sfdcfox's user avatar
  • 493k
1 vote
Accepted

How to Avoid Heap Size Error on response body

In general, you can dump the unnecessary data to try and get your heap under control. You can do this by adding curly braces around the data you want to unload before Apex realizes you're over the ...
sfdcfox's user avatar
  • 493k
0 votes

Data not visible in UI for Managed package

Because it is executed from the package's post-install script, the batch will run in the context of the package's "ghost user". If you have records being created by the batch, unless you ...
Phil W's user avatar
  • 36.6k
3 votes

Batch and custom metadata

It depends on how you write the code. There are three general moments you can set the custom metadata. public class BatchClass implements Database.Batchable<sObject> { CustomMetadata__mdt[] ...
sfdcfox's user avatar
  • 493k
1 vote
Accepted

Options to calling Autolaunched flow from apex batch job

You could directly pass in collections objects as a list then loop over it within the flow. For this answer I'm using Account object as an example. Variable to create on flow: Apex Code: List<...
Liam Gatt's user avatar
  • 126
0 votes

using today date in Database.getQueryLocator query String throwing errors

I'll change my own code to use an inline query with bind variable as recommended by @sfdcfox above, but if you need to use Database method, Database.getQueryLocatorWithBinds was introduced in Spring '...
MikeA's user avatar
  • 1,095
2 votes
Accepted

Test Class Error for a Batch Apex Class

User is an example of a setup object. One of the special things about setup objects is that they have access to the actual records of those objects in the org you're running the tests in; even if you ...
Derek F's user avatar
  • 62k
1 vote
Accepted

Best way to update thousands of records with callouts in Salesforce

I have a lot of feedback regarding this code, so most of this is answered with inline comments. If you're getting "too many callouts," then your scope isn't working correctly. Having a scope ...
sfdcfox's user avatar
  • 493k

Top 50 recent answers are included