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
randombardrandombard 

Test if old value was blank

HI All,

 

I have had a search arround but coulnt find anything.

 

I want to test if a field was previosly blank and now is not then if its not blank execute code. i have everything for if its not blank but i cant work out out to test if it was previosly blank.

 

do I need to make use of trigger.old?

 

Thanks

R

randombardrandombard

Seem to have got it with

 

Account OLDA = trigger.oldMap.get(A.ID);

 

then reference the filed I want to test with OLDA.fieldtotest

 

please let me know if I could do this better.

 

R

HariDineshHariDinesh

Hi,

I think this is fine; you will get the previous values (old values) from trigger.old or trigger.oldmap.

If in this way you can refer the field what you want then it is fine.