Can a custom function close or delete all open activities for a potential

Can a custom function close or delete all open activities for a potential

I have a sales workflow within a Zoho CRM that schedules about ten phone calls / emails for the sales rep (spaced out over 30 days) for new potential records.

I would like to add a button for the sales reps to use once they make contact with the lead and need to cancel all the remaining scheduled follow-ups (Cancel remaining follow ups).

Can someone point me in the right direction of how a custom function could query and update all "open" activities associated with a potential record ID and delete them?

Thank you in advance!