Custom Functions - Calculate Commission - failure after migration from US to EU
Hello,
i would ask for help. My Custom Function - Calculate Commission stopped working and shows a failure.
Mismatch of data type expression. Expected List but found String
What is the problem? Could anyone help?
Here is script:
- void automation.ObliczProwizje(Int quoteId)
- {
- quoteMap = zoho.crm.getRecordById("Quotes",quoteId.toLong());
- productDet = ifnull(quoteMap.get("Product_Details"),"");
- field1 = ifnull(quoteMap.get("Typ_Prowizji"),"");
- if(field1 == "Nowa")
- {
- fieldapiname = "Prowizja_Nowe";
- }
- if(field1 == "Nowa-Wznowienie")
- {
- fieldapiname = "Prowizja_Nowe";
- }
- if(field1 == "Wznowienie")
- {
- fieldapiname = "Prowizja_Wznowienia";
- }
- newvalue = 0.0;
- for each eachProd in productDet
- {
- qty = ifnull(eachProd.get("quantity"),"0").toLong();
- total = ifnull(eachProd.get("total"),"0").toLong();
- productId = ifnull(eachProd.get("product"),"").get("id");
- proDetails = zoho.crm.getRecordById("Products",productId.toLong());
- newcommission = ifnull(proDetails.get(fieldapiname),"0.0").toDecimal();
- newvalue = newvalue + newcommission * total * 0.01;
- }
- params = Map();
- params.put("Total_Commission",newvalue);
- updateResp = zoho.crm.updateRecord("Quotes",quoteId.toLong(),params);
- info params;
- info updateResp;
- }