1

I have a very general question about the data flow when dealing with formula fields and triggers - I'm writing a trigger that will update a text field on Contact objects whenever the parent Account is updated, and that works just fine and dandy (yay!).

However there is also a Formula field on the Contact object that someone else previously set up that pulls in the value for Client Type from the parent Account, but only when Client Type is A or B (hence the formula). Since this works great when a Contact is created or updated through the CRM (I haven't tried it with the API), but not when the Account is updated, will the record update I initiate for a contact in the Trigger allow the formula field to update properly? Or is there some way I can assign a value to that field to make sure the correct value is saved?

Thanks! --Lisa

  • 2
    I believe formula fields are evaluated at access time rather than stored as calculated values. – techtrekker May 19 '13 at 16:34
1

To clarify: Evaluating a formula field at runtime means that formula fields are updated every time you look at the record. If a Contact formula field is set to the first letter of the Account's name, then changing the Account name will change the formula field immediately.

The inner workings of formulas are not important here. What is important is that as the name of the Account changes, the Contact formula field reflecting the Account name will stay in perfect synchronization.

While my example is not exactly the one you have, I hope it illustrates how formula fields work.

  • It does, thank you! – Lisa May 20 '13 at 2:06
1

Formula fields are calculated for sure once trigger will update contact record .

Even if parent record (Account) is updated formula field will take care.

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.