+ Start a Discussion
GoForceGoGoForceGo 

Formula fields null in a trigger?

I have an after update trigger.

 

The value of formula fields is null. If I query the database again, it shows the values. My formula fields have a reference to lookup field - i.e if my object X has a reference to Object Y, the formula field on X is referencing Y__r.Visits__c

 

I don't see this documented anywhere...

 

My OwnMy Own

Can you please post your code?. 

Devendra NataniDevendra Natani

Hi,

 

Trigger.New will not return the value of the formula field. If you query that field then you can see the values. Formula fields values always calculated when it renders.

 

Thanks,

Devendra Natani

Blog

GoForceGoGoForceGo

That's what I noticed.  The thinking that all object fields are visible in Trigger is not true!

 

SlmjSlmj

Hi,

I also noticed that isnull function returns a true value on a reference.

But it's possible to check if a reference is not specified by using:  YourReference <> '' 

 

regards