AppleScript to delete Calendar.app alarms not working in Catalina

Having now fixed an AppleScript to add events to Calendar.app that stopped working following an update to Catalina. (AppleScripts to add Calendar event not working in Catalina? - #9 by justal) I’m now trying to get another script that also stopped working under Catalina.

This one is supposed to delete alarms from a Calendar event (amongst other things). All seem to be working with it except for the bit that delete the alarms. I’ve set up a test script in Script Editor to try to work out where the issue lies. The script looks like this:

tell application "Mail"
	set invoicenumber to "94"
	my removeAlarm(invoicenumber)
end tell


-- Remove Alarm from specified calendar event.
on removeAlarm(invoicenumber)
	set receiptdate to current date
	tell application "Calendar"
		tell calendar ("Invoices")
			set thisevent to first event where its summary = "Check Invoice #" & invoicenumber
			set description of thisevent to description of thisevent & return & "Paid: " & receiptdate
			delay 10
			tell thisevent
				delete mail alarms of thisevent
				delay 10
				delete sound alarms of thisevent
			end tell
		end tell
	end tell
end removeAlarm

When I run it I get the following error:

error “Calendar got an error: AppleEvent handler failed.” number -10000

The line highlighted in the script is:

delete mail alarms of thisevent

Can anyone see what is wrong with that line? has the syntax for deleting mail alarms changed in Catalina?

Note: It was all working perfectly in High Sierra.
Thanks,
Alan.

Is this the same one as this?:

No, I’ve fixed that one and I even linked to that thread in this post. This is different as I’m now trying to delete alarms from a Calendar event in Catalina. The other thread was related to adding events, this is related to deleting alarms.

At least this time I’m getting an error message which might help someone point me int he right direction. Although, you would think that a simple statement such as

delete mail alarms of thisevent

wouldn’t cause any issues. Who’d have thought so much would have changed with AppleScript in the update to Catalina!?