Hi Michael,
Which SR version are you on? Firing a custom event from a listener is already a built in feature.
Go the Script Listeners page and click "Fire an event when condition is true."
You can configure when you want to fire the event and which event to fire.
If you need to create a new custom event, you should see this page in the Atlassian docs:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.