Custom Functions - Calculate Commission - failure after migration from US to EU

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:


  1. void automation.ObliczProwizje(Int quoteId)
  2. {
  3. quoteMap = zoho.crm.getRecordById("Quotes",quoteId.toLong());
  4. productDet = ifnull(quoteMap.get("Product_Details"),"");
  5. field1 = ifnull(quoteMap.get("Typ_Prowizji"),"");
  6. if(field1 == "Nowa")
  7. {
  8. fieldapiname = "Prowizja_Nowe";
  9. }
  10. if(field1 == "Nowa-Wznowienie")
  11. {
  12. fieldapiname = "Prowizja_Nowe";
  13. }
  14. if(field1 == "Wznowienie")
  15. {
  16. fieldapiname = "Prowizja_Wznowienia";
  17. }
  18. newvalue = 0.0;
  19. for each  eachProd in productDet
  20. {
  21. qty = ifnull(eachProd.get("quantity"),"0").toLong();
  22. total = ifnull(eachProd.get("total"),"0").toLong();
  23. productId = ifnull(eachProd.get("product"),"").get("id");
  24. proDetails = zoho.crm.getRecordById("Products",productId.toLong());
  25. newcommission = ifnull(proDetails.get(fieldapiname),"0.0").toDecimal();
  26. newvalue = newvalue + newcommission * total * 0.01;
  27. }
  28. params = Map();
  29. params.put("Total_Commission",newvalue);
  30. updateResp = zoho.crm.updateRecord("Quotes",quoteId.toLong(),params);
  31. info params;
  32. info updateResp;
  33. }