Using date fields data from subforms

Using date fields data from subforms

Hello, I'm working on setting reminders or sending emails based on date fields within a subform in a Zoho CRM module. Unfortunately, standard workflow rules don't support this feature. I've written a Deluge script for this purpose, but I'm encountering an error. I'd appreciate any guidance or assistance in resolving this issue to enable reminders for expiring dates within subforms.

im stuck gettig this error
Failed to save the function
  • No. of arguments mismatch for the built-in function 'daysBetween' Line Number: 19

Here is the script

// Get the Accounts module records
accounts_records = zoho.crm.getRecords("Accounts");

// Loop through each account record
for each account_record in accounts_records {
    // Get the Account ID for each record
    account_id = account_record.get("id");

    // Retrieve the NDA subform records for the current account record
    nda_subform = zoho.crm.getRelatedRecords("Accounts", account_id, "NDA");

    // If the NDA subform records exist for the current account record
    if (nda_subform != null && nda_subform.size() > 0) {
        // Loop through each NDA subform record within the current account record
        for each nda_record in nda_subform {
            expiration_date = nda_record.get("Expiration_Date");

            // Calculate the difference in days between expiration and current date
            days_difference = zoho.date.daysBetween(zoho.currentdate,expiration_date);

            // Check if the expiration date is within 3 months (approximately 90 days)
            if (days_difference <= 90 && days_difference > 0) {
                admin_userid = zoho.adminuserid;

                // Compose the email content
                email_content = "Your NDA is expiring in 3 months. Please take necessary actions.";

                // Send email from and to the admin user
                zoho.mail.send({
                    from: admin_userid,
                    to: admin_userid,
                    subject: "NDA Expiration Reminder",
                    content: email_content
                });
            }
        }
    }
}