Function that can check a field in a subform and if it is saved for a value less than a specific number it changes another field to a certain value

Function that can check a field in a subform and if it is saved for a value less than a specific number it changes another field to a certain value

Hi, I have a field called Fees in a subform and I want to create a function to change another field called Rate Change Approval Status to be pending approval if the value of Fees field is changed to be less than 2
Note: all these fields are in accounts module.

Wrote that script but it is not working at all.
  1. Fees = "Fees";
  2. Fees_Rates = "Fees_Rates";
  3. Rate_Change_Approval = "Rate_Change_Approval";

  4. fees = toDecimal(getFieldValue(Fees));
  5. fees_rates = toDecimal(getFieldValue(Fees_Rates));
  6. rate_change_approval = toText(getFieldValue(Rate_Change_Approval));

  7. if (fees < 2.00 || fees_rates < 2.00) {
  8.     if (rate_change_approval != "Pending Approval") {
  9.         update_rate_approval = zoho.crm.updateRecord("Accounts", rate_change_approval, {"Rate_Change_Approval": "Pending Approval"});
  10.         info update_rate_approval;
  11.     }
  12. }