So you think, OK, just dismiss the popup that says "Unpacking results" and get on with it.

The thing is, it looks as though the anonymous Apex code that was run, hasn't quite finished, as though the commit hasn't happened yet. Because the log file claims that DML updates were done, but when I look in Salesforce, the records haven't changed.

This is my code, which attempts to put opportunities in a certain stage depending on whether a document exists in one of its quotes:

List<Opportunity> oppList = [SELECT Id FROM Opportunity WHERE StageName = 'Onderhandeling'];
System.debug('oppList.size = ' + oppList.size());

List<Quote> quoteList = [SELECT Id FROM Quote WHERE OpportunityId IN :oppList];
System.debug('quoteList.size = ' + quoteList.size());

List<Id> quoteListCopy = new List<Id>();
for (Quote q : quoteList) {
System.debug('quoteListCopy.size = ' + quoteListCopy.size());

List<ContentDocumentLink> relevantQuoteIdList = [SELECT LinkedEntityId FROM ContentDocumentLink WHERE LinkedEntityId IN :quoteListCopy];
System.debug('relevantQuoteIdList.size = ' + relevantQuoteIdList.size());

List<Id> relevantQuoteIdListCopy = new List<Id>();
for (ContentDocumentLink c : relevantQuoteIdList) {
System.debug('relevantQuoteIdListCopy.size = ' + relevantQuoteIdListCopy.size());

List<Quote> relevantOppIdList = [SELECT OpportunityId FROM Quote WHERE Id IN :relevantQuoteIdListCopy];
System.debug('relevantOppIdList.size = ' + relevantOppIdList.size());

Set<Id> oppIdList = new Set<Id>();
for (Quote q : relevantOppIdList) {
System.debug('oppIdList.size = ' + oppIdList.size());
List<Opportunity> oppsToUpdate = [SELECT Id, StageName FROM Opportunity WHERE Id IN :oppIdList];
for (Opportunity o : oppsToUpdate) {
    System.debug('updating ' + o.Id);
    System.debug('current stage ' + o.StageName);
    o.StageName = 'Offerte aangeboden';
Database.SaveResult[] srList = Database.update(oppsToUpdate, false);

for (Database.SaveResult sr : srList) {
    if (sr.isSuccess()) {
        System.debug('Successfully updated opp. Opp ID: ' + sr.getId());
    else {
        for(Database.Error err : sr.getErrors()) {
            System.debug('The following error has occurred.');
            System.debug(err.getStatusCode() + ': ' + err.getMessage());
            System.debug('Opp fields that affected this error: ' + err.getFields());

for (Opportunity o : [SELECT Id, StageName FROM Opportunity WHERE Id IN :oppIdList]) {
    System.debug('opp ' + o.Id);
    System.debug('current stage ' + o.StageName);

And this is part of the log file:

Line 722: 15:38:31.1 (51977582)|USER_DEBUG|[31]|DEBUG|oppIdList.size = 3
Line 743: 15:38:31.1 (56663672)|USER_DEBUG|[34]|DEBUG|updating 0063M000001twqYQAQ
Line 747: 15:38:31.1 (56739446)|USER_DEBUG|[35]|DEBUG|current stage Onderhandeling
Line 759: 15:38:31.1 (56974284)|USER_DEBUG|[34]|DEBUG|updating 0063M000002IBimQAG
Line 762: 15:38:31.1 (57000574)|USER_DEBUG|[35]|DEBUG|current stage Onderhandeling
Line 773: 15:38:31.1 (57156714)|USER_DEBUG|[34]|DEBUG|updating 0065800000kpzR1AAI
Line 776: 15:38:31.1 (57180768)|USER_DEBUG|[35]|DEBUG|current stage Onderhandeling
Line 3016: 15:38:31.1 (454870678)|USER_DEBUG|[42]|DEBUG|Successfully updated opp. Opp ID: 0063M000001twqYQAQ
Line 3027: 15:38:31.1 (455022304)|USER_DEBUG|[42]|DEBUG|Successfully updated opp. Opp ID: 0063M000002IBimQAG
Line 3038: 15:38:31.1 (455146372)|USER_DEBUG|[42]|DEBUG|Successfully updated opp. Opp ID: 0065800000kpzR1AAI
Line 3071: 15:38:31.1 (460035571)|USER_DEBUG|[54]|DEBUG|opp 0063M000001twqYQAQ
Line 3074: 15:38:31.1 (460077676)|USER_DEBUG|[55]|DEBUG|current stage Offerte aangeboden
Line 3085: 15:38:31.1 (460251465)|USER_DEBUG|[54]|DEBUG|opp 0063M000002IBimQAG
Line 3088: 15:38:31.1 (460274456)|USER_DEBUG|[55]|DEBUG|current stage Offerte aangeboden
Line 3099: 15:38:31.1 (460422242)|USER_DEBUG|[54]|DEBUG|opp 0065800000kpzR1AAI
Line 3102: 15:38:31.1 (460442947)|USER_DEBUG|[55]|DEBUG|current stage Offerte aangeboden


15:38:31.425 (425795307)|LIMIT_USAGE_FOR_NS|(default)|
Number of SOQL queries: 7 out of 100
Number of query rows: 452 out of 50000
Number of SOSL queries: 0 out of 20
Number of DML statements: 1 out of 150
Number of DML rows: 3 out of 10000
Maximum CPU time: 73 out of 10000
Maximum heap size: 0 out of 6000000
Number of callouts: 0 out of 100
Number of Email Invocations: 0 out of 10
Number of future calls: 0 out of 50
Number of queueable jobs added to the queue: 0 out of 50
Number of Mobile Apex push calls: 0 out of 10

1 Answer 1


When Unpacking Results hangs, it usually means you've done Something Really Bad. The server's transaction crashed (an Internal Server Error), and the error handler itself also crashed, resulting in this log you can't open. It's weird to see the logic get all the way to the end and reach this scenario, but I'm rather used to logs that can't be opened (I run into an unusual number of bugs, probably because I experiment with unusual algorithms).

Check the Developer Console's Developer Console (press F12) and see if there's any errors there. This should probably result in an error you can use to at least figure out what's going on. Maybe some post-commit logic failed or something, it's hard to tell. These problems are relatively rare, but always incredibly frustrating to debug. If you find any errors on the browser's Developer Console, we can probably help you further, or you might need to contact Technical Support.

  • Ah, your remarks make sense (as they usually do). I am doing this on a sandbox, and two of the three records can't be updated manually. The error is: "You encountered some errors when trying to save this record field integrity exception: unknown (0065800000kpzR1|1||288900||80,)" I thought the SaveResult objects would take care of this, but obviously, they didn't. And worse, even though the log suggests everything is dandy, it isn't. Thanks! Jul 23, 2020 at 14:23
  • @SanderdeJong Yes, it sounds like you need to contact support if you can't figure out which field it is. It could be a unique index or encryption or something else. There's clearly a hole that you've found. I'd suggest getting this to R&D.
    – sfdcfox
    Jul 23, 2020 at 14:30
  • 1
    It is an issue that we always have with our partial data sandbox. Other people have it as well, I have seen this on StackExchange. Solution involves R&D indeed, but does not always solve the problem. We have kind of learned to live with it. Jul 23, 2020 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .