Custom Button on view list

Custom Button on view list

Greeting,

I added a button on a view list.
My goal is to select multiple lines to update the information of each row.
My function below works well if I select only 1 row, but do not work anymore if I select multiple row.
What should I change to be able to select multiple row ?

Thanks.



IdsList = POID.toList("|||");
info IdsList;
for each  IdStr in IdsList
{
response = zoho.crm.searchRecords("PO_x_veh","(PO_installateur:equals:" + IdStr + ")");
number = 0;
planifie = 0;
date_depasse = 0;
verification = 0;
Facture_client_a_traiter = 0;
Termine = 0;
for each  ResponseRecord in response
{
number = number + 1;
Etat = ResponseRecord.get("Etat");
if(Etat = "Planifié")
{
planifie = planifie + 1;
}
if(Etat = "Date dépassée - rapport non reçu")
{
date_depasse = date_depasse + 1;
}
if(Etat = "Vérification rapport à faire")
{
verification = verification + 1;
}
if(Etat = "Facture client à traiter")
{
Facture_client_a_traiter = Facture_client_a_traiter + 1;
}
if(Etat = "Terminé")
{
Termine = Termine + 1;
}
}
mp = Map();
mp.put("NB_V_hicules",number);
mp.put("NB_Planifi",planifie);
mp.put("NB_Date_d_pass_e_rapport_recevoir",date_depasse);
mp.put("NB_V_rification_rapport_faire",verification);
mp.put("NB_Facture_traiter",Facture_client_a_traiter);
mp.put("NB_facture_trait_e",Termine);
update = zoho.crm.updateRecord("PO_INSTALLATEURS",POID.toLong(),mp);
}
return "Mise à jour réussie :)";