Field Not Updating in FSM Script - Service and Parts module.

Field Not Updating in FSM Script - Service and Parts module.

Dear Team,

I am reaching out regarding a script I have implemented in Zoho FSM to automate the calculation of the End of Service date based on the End of Sale date in the Service and Parts module.

Overview of the script:

  • Fetches the End_of_Sale__C and End_of_Service__C fields from the Service and Parts record.

  • Checks if the End_of_Sale__C date is valid.

  • Calculates a new End_of_Service__C date by adding 5 years to the End of Sale date.

  • Updates the End_of_Service__C field only if it is empty or different from the calculated date.

Despite executing successfully, the script does not update the End_of_Service__C field as expected. I would greatly appreciate guidance on why the update might not be taking effect and any recommendations to ensure the field updates correctly.

Script:

// Fetch fields from input var_End_of_Sale = service_and_part.get("End_of_Sale__C"); // Check if End_of_Sale date is valid if (var_End_of_Sale != null && var_End_of_Sale.isDate()) { // Calculate End of Service = End of Sale + 5 years var_New_End_of_Service = var_End_of_Sale.addYear(5); var_New_End_of_Service_Str = var_New_End_of_Service.toString("yyyy-MM-dd"); var_Update_Map = Map(); var_Update_Map.put("End_of_Service__C", var_New_End_of_Service_Str); var_Record_Id = service_and_part.get("id"); var_Update_Response = zoho.fsm.updateRecord("Service_And_Parts", var_Record_Id.toLong(), var_Update_Map); }

Thank you for your assistance.

Best regards,
Chethiya

    Nederlandse Hulpbronnen