Rollup the Potential Amount to Accounts function doesnt work

Rollup the Potential Amount to Accounts function doesnt work

Hey,

I added two arguments, AccountID from Accounts and Amount from Deals.

I filled in the code and attached workflow to it, but as a result it gives me a zero amount.

Here's my code:
resp = zoho.crm.getRelatedRecords("Deals","Accounts",AccountId.toString());
//info resp;
total = 0.0;
for each  rec in resp
{
stage = rec.get("Stage").toLowerCase();
if(stage.contains("Wysłane"))
{
total = total + ifnull(rec.get("Amount"),"0.0").toDecimal();
}
}
info total;
updateResp = zoho.crm.updateRecord("Accounts",AccountId.toLong(),{"Ca_kowita_sprzeda1":total});
info updateResp;
//Replace 'Fieldapiname' with your field api name to update the deal's amount.

If stage is "Wysłane" meaning sent, the amount of this deal should be summed up with any other that is in this stage and should result in filling in the field "Ca_kowita_sprzeda1" meaning Total revenue

I just can't make it work. Anyone else had a problem with this function?