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
UpendraUpendra 

What is the disadvantages of a formula field compare to text field?

I want to populate a parent field value in a chaild field for displaying in a standard visual force page. So, I thought I will create a formula field for the same, but one of my collegue said don't create formula field, create a text field and assign the text field value while creating the child record in trigger.

So, I just want to know, which approach is better and why?

NOTE: The parent child relationship is lookup relationship.
Best Answer chosen by Upendra
FearNoneFearNone
Hi Upendra,

Formula field values are NOT stored in the database and are calculated after each time records are being read from database. If you can imagine, this can make things slow down. You see, even if values where not changed, formula calculation has still to be processed.
As your friend suggested, it is better to write/update the value during trigger. Thus saving you a process time.


Hope this can help.

All Answers

FearNoneFearNone
Hi Upendra,

Formula field values are NOT stored in the database and are calculated after each time records are being read from database. If you can imagine, this can make things slow down. You see, even if values where not changed, formula calculation has still to be processed.
As your friend suggested, it is better to write/update the value during trigger. Thus saving you a process time.


Hope this can help.
This was selected as the best answer
Mohan ChanderMohan Chander
Hi Upendra,

Why would i want to create a trigger just to populate a field value?? Although formual fields take some processing i dont think we would explictly need to write trigger for this scenario. We can as well make it an input field and populate it via process builder and then as the field is read only its ok to use formula field