Let me try to ask this with out explaining my overly complicated case in detail. I have custom objects that heavily use formulas, rollup summaries and triggers.

For the last days I am chasing hard to reproduce and even harder to understand bugs of the kind:

  1. Formula does not produce the desired result.
  2. Rollups do no work
  3. Trigger DML changes work in tests but not in the UI

I checked the usual root causes like

  • trigger recursion errors
  • exceptions hidden in the logs thats silently stopped a whole cascade of changes
  • invalid formulas

and I am still absolutely clueless.

What I am looking for are answers of the kind "Yes this sometimes happens when you" or "I had the same and fixed it with" because creating a minimal example that would reproduce the problem is hard here.


I remember this problem distinctly especially with RSF and formulas based on RSF fields. Here is a simple use case

  • Parent Obj P contains RSF on Child object C. Parent object may also have formulas based on the value of the RSF
  • Triggers exist on both Child C and Parent C
  • DML occurs on child C. C's trigger does DML upon parent P
  • Parent P triggers fires, code in parent P trigger uses values of the RSF field and formulas based on RSF field in the logic

The last step is where the problem lies as the RSF on parent P is not calculated by SFDC (see Trigger Order of Execution) until all the triggers on Child C are completed. The logic within P's trigger is thus making an assumption about database state that is not valid

  • Comes very close to my case. I think I will have to dig deeper here. – Robert Sösemann Sep 19 '14 at 7:19
  • In the end my problem was a rollup field based on a formula field that use cross-object data. I still choose this a an answer as it contains valueable information that (other that for my problem) cannot be found in the documentation easily. – Robert Sösemann Sep 19 '14 at 9:16
  • glad you found it – cropredy Sep 19 '14 at 16:08

I had a situation recently where adding a simple workflow item (set a field under certain conditions) interfered somehow with triggers. I've got several levels of objects and trigger activity going on in too many of them.

Turning off that one workflow got the triggers working again.


For me the biggest challenge in such cases is to dig the relevant stuff out of the logs. Restarting the log form the setup again and again really sucks. Using developer console also doesn't feel much better. It often takes a lot of time.

Last time I had something like your issue, the error was hidden in nested try/catch blocks. To trace what happens I usually take my own logging classes (which are also not perfect) and if possible an Execute Anonymous contexts to invoke the cascade. Test-contexts brought me too often misleading results and debugging with Execute Anonymous often lets you vary lots of different boundary conditions quickly.

If the cascade stretches over more transactions I usually try to log into the database. Unfortunately another challenge with this approach for logging and tracing is "You have uncommitted work pending. Please commit or rollback before calling out" - so it doesn't work always.

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.