+ Start a Discussion

Status: Internal Salesforce.com Error - Trigger after update

I'm attempting execute a trigger on case via a utility class, after update, and getting the "Internal Salesforce.com Error" 


11:21:10.529 (1529716000)|FATAL_ERROR|Internal Salesforce.com Error


I get Success on before update, but the update doesn't happen.  I've debugged down to this last piece and don't see any issues in my queries, no select statements in for loops, etc.  


I see recent posts re: this error as being a SF.com internal issue, does anyone know?  



4 mos ago: 


"Despite what the error message says and what product management’s comments here indicate,  filing a case with support is generally not encouraged or supported.   

Support will close your ticket and either tell you to post this on the idea exchange or state that this requires developer support to be worked.  Sales has confirmed this is the case for any internal server errors that come from either apex or visual force code.
It is sad that salesforce (support and sales anyway) wants you to purchase developer support to give them an example of a bug in their code."  https://success.salesforce.com/ideaView?id=08730000000JKDp


Can you share your code?

Issue mgiht be salesforce internal but just to make sure that code is correct.


I got past the internal error by changing my code to use the original trigger context map vs. having added to a new map.  


New issue is that I cannot update the case, from the email, on insert.  I can do it on update, however.


1) I fire the trigger on insert (create) - i.e. when a case is emailed to salesforce

2) I get the first email associated to the case

3) I parse the email body

4) I update the fields on case,  which only works on update


public with sharing class CaseParsingWorkflow implements TriggerWorkflow {

Map<Id, Case> newMap;

Map<Id, Case> caseMap;

List <String> parts;

String subject;


public CaseParsingWorkflow(Map<Id, Case> newMap){

this.newMap = newMap;



    private static Boolean hasExecuted{get{if(hasExecuted == null) hasExecuted = false; return hasExecuted;} private set;}

    public void execute()





        hasExecuted = True;



private void parseEmail(){

  Map<Id,EmailMessage> caseEmailMap = new Map<Id,EmailMessage>();

  List <EmailMessage> emails = [SELECT HtmlBody, ParentId, Subject FROM EmailMessage where ParentId IN: newMap.keySet() ];


        if (emails.isEmpty()) {




        for (EmailMessage email: emails) {

            caseEmailMap.put(email.ParentId, email); 



        String html; 

        for (Case c: newMap.values() ){

            EmailMessage firstEmail = caseEmailMap.get(c.Id);

            if (firstEmail != null) {

            html = firstEmail.HtmlBody;

            subject = firstEmail.Subject;




CaseEmailParser cp = new CaseEmailParser();

    parts = cp.doParse(caseMap, html);


    if(!parts.isEmpty() ){







private void updateCase(CaseEmailParser cp){ 


//get field vals from case parsing class

String country = cp.getCountry(parts);

String permalink = cp.getPermalink(parts); 

String caseType = cp.getCaseType(subject);



        for(Case c: newMap.values()){

         //update case fields - working on update