In my previous posts I have reported an issue which yields

System.CalloutException: You have uncommitted work pending. Please commit or rollback before calling out

exception where it should not arise.

First time I reported this was at February 12, 2015, later on November 9, 2016 I have noted that the corresponding known issue was marked as resolved but the actual problem wasn’t solved, also on December 1, 2016 I have suggested a workaround to this bug.

As of Summer 2019 (v.46), I can confirm that this particular bug seems to be resolved.

However, another bug has arised recently.

To reproduce it, a dummy batch class is needed.

public class b implements Database.Batchable<SObject>,Database.AllowsCallouts{
public Database.QueryLocator start(Database.BatchableContext bc) {
return Database.getQueryLocator('SELECT id FROM user WHERE IsActive=true limit 1');
public void execute(Database.BatchableContext bc, List<User> users) {
new Http().send(new HttpRequest());
public void finish(Database.BatchableContext bc) {}


@isTest class TOTTest {
private static final Integer STATUS_CODE_200 = 200;
private static final String STATUS_OK = 'OK';
private static final String SUCCESS_RESPONSE = '{"response":{"metadata":[{"totalrowcount":1},{"rendertime":0}]}}';

public class q implements Queueable,Database.AllowsCallouts{
public void execute(QueueableContext context) {
new Http().send(new HttpRequest());

private static testMethod void testQ() {
Test.setMock(HttpCalloutMock.class, new MockHttpResponse());
System.enqueueJob(new q());


private static testMethod void testB() {
Test.setMock(HttpCalloutMock.class, new MockHttpResponse());
Database.executeBatch(new b());


static void insertData() {
//insert new Test_Object__c();

insert new User(

This entry was posted in Uncategorized. Bookmark the permalink.

4 Responses to

  1. Mo Ham says:

    Do you have a possible workaround for this issue?

  2. CoreyY says:

    The ‘new bug’ you describe above in v46.0 of the API seems to be this one which has come back (meant to have been solved in Spring ’16 Patch 2.0):

    Has it been reported to Salesforce again?

  3. patlatus says:

    Yes, I have reported this to Salesforce. They had been investigating this issue for a month before I got a response with link to known issue or salesforce internal issue tracking number.
    My case number was 23600897, I have opened this case on the July 10th. I received a link to a known issue and internal salesforce issue tracking number W-4947848 on August 8th, however, I am not sure if this is the same issue as I have since that issue doesn’t have a workaround and for my case I have a workaround.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s