function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
MichaelAnthonyMichaelAnthony 

Trigger causing e-mail approval to fail - UPDATED

I have an approval proccess I am developing in the sandbox. On approval it does a field update, this causes an After Update trigger to fire. 

 

The approval process works great if the approver does the approval within salesforce, from the home page. However, when the approver attempts to approve it from e-mail, an e-mail is returned stating:

 

'An error occurred and your workflow approval message was not processed. Please contact your system administrator.'

 

Looking in the debug log I see:

CODE_UNIT_STARTED|[EXTERNAL]|01qT00000000g70|QuoteName on Quote trigger event AfterUpdate for [0Q0T00000004b1y]

15:03:40.182 (182968000)|EXCEPTION_THROWN|[EXTERNAL]|System.ListException: Row with null Id at index: 0

 

There is one checkbox field update and If I remove the field update, it works from e-mail. At first I thought this was it, but then I removed the trigger and it also works from e-mail. I've commented out every piece of the trigger code, minus a one system.debug statement and still it fails.

 

 

The field I am updating had no field restrictions and the process works fine inside of Salesforce. Any idea what is happening?

 

Thanks

 

Ok, I've rebuilt the trigger in Salesforce, rather then eclipse. Its failing at:

 

for(Quote q: trigger.new){  

 

QuoteID = q.ID; 

QuoteOppID = q.OpportunityId;  

 

}

 

Does the trigger.new list not get populated when fired from the e-mail API?

Edwin VijayEdwin Vijay

Can you post the entire trigger code?

 

 

MichaelAnthonyMichaelAnthony

At this point, the entire code is

 

trigger QuoteName on Quote (after update) {
ID QuoteID;

ID QuoteOppID;

         for(Quote q: trigger.new){

          QuoteID = q.ID;    

          QuoteOppID = q.OpportunityId;       } 

         }

 

I rebuilt it starting from nothing to narrow down where it's failing. As soon as I reference trigger.new it causes the issue.

MichaelAnthonyMichaelAnthony

I think I am going to be able to accomplish what I need to using a series of field formulas, but still don't understand why the e-mail API is not passing the trigger.new list

ODCGI80101ODCGI80101

Another forum mentions Salesforce acknowledge this. They are working on approval via email and trigger issue.

 

http://boards.developerforce.com/t5/Apex-Code-Development/Issuw-with-Wokflow-and-trigger-after-Update/m-p/335259#