I'm working on a custom function in Zoho CRM to calculate the total price of an order when a new record is created in a custom module called Orders. The function is triggered via a workflow rule. The fields in question are dropdowns, and their API names are confirmed to be correct.
Here’s the script I’m using:
void automation.TotalPriceCalc() {
// Retrieve values from the order
personalization = input.Personalization_Option;
dividers = input.D_Dividers;
dodts = input.DoDts;
total_price = 0;
if (personalization == "One Letter") {
total_price = total_price + 119;
} else if (personalization == "Two Names") {
total_price = total_price + 235;
}
if (dividers == "One Small") {
total_price = total_price + 55;
}
if (dodts == "One") {
total_price = total_price + 15;
}
// Update Total Price field
input.Total_Price = total_price;
}
Field Details:
Personalization_Option: Dropdown field.
D_Dividers: Dropdown field.
DoDts: Dropdown field.
The Issue:
When I try to run this script, I get the following error:
Variable 'Personalization_Option' is not defined.
I get the same error for the two other fields.
What I’ve Tried:
- Verified the API names for all fields in the Orders module under the module settings.
- Confirmed that the workflow is set to trigger when a new record is created in the Orders module.
Questions:
- Why is Zoho Deluge throwing a "Variable not defined" error even though the API names are confirmed?
- Is there an issue with how I’m accessing dropdown fields in the input object?
- How can I ensure the dropdown fields are properly retrieved and used in the function?
Any insights or suggestions would be greatly appreciated!