Hello, I'm trying to create a function that adds all of individual tax rates from a few jurisdictions. I'm getting an error on line 9 - Value is empty and 'get' function cannot be applied. I've checked that I have data in each of the required fields, including TaxingUnits on the properties module, but it doesnt seem to pick up the data in the multi select look up field.
void automation.TaxUnitSummation()
{// Step 1: Get the linked Property ID from the Savings Calculation
savingsRecordId = 6518972000000609766; // ID of the Savings Calculation record
savingsRecord = zoho.crm.getRecordById("Savings Calculations", savingsRecordId);
propertyId = savingsRecord.get("Property");
// Step 2: Fetch the Taxing Units linked to the Property
propertyRecord = zoho.crm.getRecordById("Properties", propertyId);
taxingUnits = propertyRecord.get("Taxing Units"); // Multi-select lookup field
// Step 3: Initialize total tax rate
totalTaxRate = 0.0;
// Step 4: Loop through each Taxing Unit and fetch the Tax Rate
for each taxingUnitId in taxingUnits
{
taxingUnitRecord = zoho.crm.getRecordById("Taxing Units", taxingUnitId);
taxRate = taxingUnitRecord.get("Tax Rate"); // Tax Rate field in Taxing Units module
totalTaxRate = totalTaxRate + taxRate;
}
// Step 5: Update the Savings Calculation record with the total Tax Rate
updateMap = Map();
updateMap.put("Total Tax Rate", totalTaxRate); // Field in Savings Calculations module
zoho.crm.updateRecord("Savings Calculations", savingsRecordId, updateMap);
}