Untitled
unknown
plain_text
3 years ago
792 B
2
Indexable
public class Helper_trigger_acc { public static void insertAcc(List<Account> listaAccount){ AggregateResult[] CountAccount =[select count(id) contatore, ownerid from account group by ownerid order by count(id)]; list <account> acc_app = new list <account>(); for(Account acc: listaAccount) { integer contatore=0; for(integer i=0;i<CountAccount.size();i++){ if(acc.OwnerId == CountAccount[i].get('owneriD')){ contatore = (integer)CountAccount[i].get('contatore'); contatore ++; } } if(contatore > 20){ acc.ownerid = (ID)CountAccount[0].get('ownerid'); } } } }
Editor is loading...