Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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?

share|improve this answer
    
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 at 2:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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