SFDC Trigger Fix Data

Posted by ExiaHuang on July 27, 2017

Trigger needs to execute before insert and before update.

Also you don’t need to update the accounts at the end of the trigger you only need to do this when you want to modify records that are not being processed by then trigger.

1
2
3
4
5
6
7
8
9
10
11
12
13
Trigger UpdateTMID on Account (before insert, before update){

for (Account acct:Trigger.new){

Integer i = 1;

system.debug('This is the number of times it is has gone through the loop' +i);

acct.PP_CLIENT_DIR_VP__c = 'JC13';

i++;
}
}