In my account object, I have a custom field aNo. This should do the same functionality as an auto number.
public class incrementHandler{
set <Id> accId;
list <Account> aList;
public incrementHandler (){
aId = new set <ID>();
aList = new list <Account> ();
}
public void onInsert( list<Account> newList){
integer count = 0;
for(Account a : newList){
accId.add(a.Id);
}
count = accId.size();
a.aNo = count;
aList.add(a);
}
update aList;
}
}
The code is not working. Where am I going wrong?