I'm using this function in a Zoho CRM workflow to update the Related Grant. This function is triggered by a rule when the LOOKUP "Grant" field is EDITED.
But I would like to update the "Grant" relation that was previously related before the change, is it possible?
RelatedActivities = zoho.crm.getRelatedRecords("Related_Activities","Grants",actId.toLong(),1,200);
info RelatedActivities;
total = 0.0;
info "rel:" + RelatedActivities;
if(RelatedActivities.size() > 0)
{
for each ele in RelatedActivities
{
total = total + ifnull(ele.get("Activity_Total_Assigned_Budget"),"0.0").toDecimal();
}
}
totalFormatted = total.toString();
mp = Map();
mp.put("Forecast",total);
update = zoho.crm.updateRecord("Grants",actId.toLong(),mp);
info mp;
info update;