Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
628 B
4
Indexable
Never
public class esenic { 
    public static void getuser(list <account>d ){
        AggregateResult[] f=[select count(id) contatore,ownerid from account group by ownerid order by count(id)];
        integer contatore;
        for(account a:d){ 
            contatore=0;
            for(integer i= 0;i <f.size();i++){
                if(a.ownerid==f[i].get('ownerid')){
                    contatore=(integer)f[i].get('contatore');
                    
                }
            }
            if (contatore>20)
                a.ownerid=(id)f[0].get('ownerid');
            
            
    }
           
}
}