I am trying to apply first run into my trigger class as below:
public class testclass{
public static boolean firstrun = true;
if (firstrun) {
if (Trigger.isInsert || Trigger.isUpdate) {
<<Execute Code here>>
fisrtrun = false;
}
}
}
While running upsert operation, above class code does not run for update as the value for firstrun become false after running insert.
Is there any other practice we can follow to apply so that apex class does not run more than once.