I have an issue and I am kinda confused by it. I am trying to write a custom function that calculates the sum of all "Invoiced amount" fields and copies it on the related deal.
taskDetails = zoho.crm.getRelatedRecords("Tasks","Deals",dealId.toLong());
suma = 0.0;
for each task in taskDetails
{
suma = suma + ifnull(taskDetails.get("Invoiced_amount"),"0.0").toDecimal();
}
updateResp = zoho.crm.updateRecord("Deals",input.dealId.toLong(),{" Invoiced_amount":suma});
info updateResp;
The Invoiced_amount fields are currency fields.
Is there any way to solve this? What have I done wrong?
Thank you!