function error - consolidate records by field for pushing to CRM
I'm writing a function to update products quantity in Zoho CRM. within my creator products form i have multiple products with the same name, so I want to sum the totals up for those products and then pass them onto CRM. However, while writing a function there seems to be one line that seems to cause me problems throwing the error on compile:
"
Error at line number : 4
Not able to find 'sum' function" ;
- fetchData = formName[ field == function_variable].sum(fetchData.fieldINform);
the function passes in the function variable.
for reference the entire function:
- void crmRecord.updateStock(string stockName)
- {
- //consolidating data and creating map to push to CRM
- fetchData = Products [ Product_Name == stockName ].sum(fetchData.Available_Stock);
- //creating map for CRM
- myFieldMap = Map();
- myFieldMap.put("Qty in Stock",fetchData);
- //sending to CRM
- crmResp = zoho.crm.updateRecord("Products","2262025000000134003",myFieldMap);
- }