Getting alarm acknowledgement notes into acknowledge email

What I'm attempting to do is get the acknowledgement notes from the most recently acknowledged alarm and include it in the body of the acknowledgement email. I have two pipelines set up. One is the active pipeline and one is the ack pipeline. When an alarm is acknowledged, it sends out an email with this as the body: "At {eventTime|hh:mm:ss}, alarm "{name}" at "{displayPathOrSource}" was acknowledged by {ackUserName}."

I've been requested to attach what was said by the acknowledger. I found this forum post that lets me get acknowledgement notes but I can't figure out how to get this information into my acknowledgement email.

When I run this script from the script console, I get the ackNotes from the specific alarm.

queryResult = system.alarm.queryStatus(path="*"+"Filter4"+"*",state=['ClearAcked'])
notes = queryResult[2].getAckData().get(CommonAlarmProperties.AckNotes)
print(str(notes))

When I try to get this same code to run in the alarm pipeline, I get "null". (I know this isn't the most recent alarm but one step at a time. Getting the ackNotes from any alarm lets me move to solving the next step of getting it from the most recent alarm.)

I've tried putting the script in a script block in the pipeline before the email gets sent and putting the variable in the email body but that didn't work. I've also tried using set property block to set a variable with the script but that didn't work either.

Am I going about this wrong or missing something? I'm still learning so I'm probably ignorant or overlooking something obvious.

Maybe try using the event object that's available in script blocks in the alarm pipeline(Scripting Object Reference). This object has ackData which returns information regarding the acknowledgement of the event. Here's an example of the script I used and its output:
In the script block:

def handleAlarm(event):
  logger = system.util.getLogger('Alarm Test')
  logger.info('Alarm acked')
  logger.info(str(event.ackData))

Output in the logs: