2

I am trying to run a standard set controller extension from execute anonymous for the purpose of debugging, however I keep getting "Internal Salesforce.com error".

I have narrowed down the offending code to the following:

Account a = new Account(Id = 'SOME_ACCOUNT_ID');
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(
    new List<Account> { a }
);

And simplifying it even further yields the same error:

ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(
    new List<Account>()
);

Is there something that I am missing, or does this look like a Salesforce bug?

2

The second error is from simplifying to the point that the list is a new, empty, list.

The first is probably because you did not insert the Account - you may have more luck with this:

Account a = new Account();
insert a;
ApexPages.StandardSetController ssc = new ApexPages.StandardSetController(
    new List<Account> { a }
);

Does that work?

  • Unfortunately that also gives the same error. Inserting the Account populates the Id which is effectively the same as instantiating a new Account SObject by passing an ID for an existing record. – luke.mcfarlane Jul 11 '14 at 2:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.