void workflowspace.Roll up amount to account(map potential)
{
accountid = input.potential.get("ACCOUNTID");
potentials = zoho.crm.searchRecords("Potentials", ("(ACCOUNTID|==|" + accountid) + ")");
//potentials = zoho.crm.searchRecordsByPDC("Potentials", ("ACCOUNTID"), accountid);
total = 0.0;
for each potential in potentials
{
stage = input.potential.get("Stage").toLowerCase();
if (stage.contains("won"))
{
total = (total + (input.potential.get("Amount")).toDecimal());
}
}
updateResp = zoho.crm.updateRecord(("Accounts"), accountid, { "REVENUE_POTENTIAL" : total });