You need to sign in to do that
Don't have an account?
Limit the record count while inserting into a list
I have a requirement to have only 5 rows added to a list (dealsplit - mentioned below). here is the code . Ho can we implement it
-------------------------------------------------------------------------------------------
public PageReference addSelectedProductAction()
{
for(ProductWrapper pw: products){
if(pw.isSelected){
pw.addDealSplitAction();
selectedProds.add(pw);
}
}
return null;
}
public PageReference addDealSplitAction(){
DealSplitWrapper dealSplit = new DealSplitWrapper(product);
dealSplits.add(dealSplit);
return null;
}
-----------------------------------------------------------------------------------------------------
thanks
if(dealSplits.size()<5){
dealSplits.add(dealSplit);
}
Regards,
Satish Kumar
Thanks for replying...
Can I add an error message here so that if the count is more than it throws an error