Given this background:

  • Firstly, a workflow or something on Contact is already in place that updates Contact.High_School_Lookup__c when a user saves a change to the value of Contact.High_School_Numeric_Code__c

  • Secondly, there's a super-complex formula field Contact.Suggested_OwnerId__c that involves, among many other things, references to Contact.High_School_Lookup__r.WhatNot__c.

What people want me to code trigger functionality for is:

  • Detecting changes to Contact.Suggested_OwnerId__c -- even when they arise "downstream" from something like a change to Contact.High_School_Numeric_Code__c -- and, whenever they happen, updating Contact.OwnerId to have the value of Contact.Suggested_OwnerId__c

I can't get this thing working.

  • BeforeUpdate on Contact doesn't work when someone modifies Contact.High_School_Numeric_Code__c because Contact.Suggested_OwnerId__c isn't based on Contact.High_School_Numeric_Code__c; it's based on Contact.High_School_Lookup__c, and that value hasn't yet been set, so Contact.Suggested_OwnerId__c is old/blank.

  • AfterUpdate on Contact doesn't work because I can't figure out a way to push an UPDATE to Contact.OwnerId without getting SELF_REFERENCE_FROM_TRIGGER exceptions. (Note: I'm tired, and it's possible I have my recursion-prevention in the wrong place, but I think I have it right...)

Do I need to tell my end-users that their wish-list inherently involves too many hops of "post-processing a user-update with code-driven updates" to satisfy Salesforce and can't be done, or am I missing something?

1 Answer 1


It's me.

Seems I didn't memorize my own lesson from when I commented "don't make your toInsert/toUpdate collection variables Static in the TidyTrigger pattern".

Yay for long walks.

It works fine now as an "After" trigger.

You must log in to answer this question.

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