+ Start a Discussion
EvertonSzekeresEvertonSzekeres 

Update +1

Hi,

There's a way to update a number custom field always increasing one more.

I want this field updated always when someone change any field in my case.
So I will put an IF in LastModifiedBy when is updated.

Thanks !
Best Answer chosen by EvertonSzekeres
Elie.RodrigueElie.Rodrigue
you can have a trigger do something like this : 
trigger AccountFieldIncrement on Account(before insert, before update)
{
       for(Account a : trigger.new)
       {
              if(a.CustomField__c == null)
              {
                      a.CustomField__c = 0;
              }
             if(a.LastModifiedById == /* add your comparison here, dont hardcode an id, query it outside of the loop*/)
            {
                    a.CustomField__c += 1; 
            }
       }
}