How to write custom function in Zoho Platform for a portal/extension?

How to write custom function in Zoho Platform for a portal/extension?

Hi, 

I am working on extensions in Zoho Platform. Here I am following the help guide of Zoho Platform. i.e.
https://www.zoho.com/developer/help/extensions/quick-start.html

Here I am trying to create Workflow in Zoho extension to perform some automated tasks. But I am getting an error while executing my code. 

The code is: 
  1. 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 });


And the error is:




Please help me to get the solution of this problem. 
Thanks