but when I use this code, it always outputs 0
- qrecs = zoho.crm.getRecordById("Quotes",qid.toLong());
- //info qrecs ;
- pds = ifnull(qrecs.getJSON("Product_Details"),List());
- mrp = ifnull(qrecs.getJSON("PartnerMonthlyTotal"),1);
- tot = 0;
- for each pd in pds
- {
- pid = ifnull(ifnull(pd.getJSON("product"),Map()).getJSON("id"),"");
- if(pid.toString().len() > 0)
- {
- prec = zoho.crm.getRecordById("Products",pid.toLong());
- //info prec ;
- if(ifnull(prec.getJSON("Product_type"),"") == "Monthly Recurring")
- {
- tot = tot + ifnull(pd.getJSON("Partner_Total"),0);
- info tot;
- }
- }
- }
- //if(tot == mrp || tot == 1)
- //{
- mp = Map();
- mp.put("PartnerMonthlyTotal",tot);
- qupr = zoho.crm.updateRecord("Quotes",qid.toLong(),mp);
- info mp;
- info qupr;
- //}
All the API names are correct, I get no errors when I test the script. it just always outputs zero