Help with iOS actionable notification dynamic response

I set up an iOS actionable notification that has two possible actions:
LEAVE_HOME
LOCK_THE_HOUSE

Both of these correspond to script names:
leave_home
lock_the_house

This works, but uses more hard-coding than I prefer:

  trigger:
    platform: event
    event_type: ios.notification_action_fired
  action:
  - service_template: >
      {% if trigger.event.data.actionName == "LEAVE_HOME" %}
        script.leave_home
      {% elif trigger.event.data.actionName == "LOCK_THE_HOUSE" %}
        script.lock_the_house
      {% endif %}

I am trying to rewrite it to something like this, where I am passing in the action name as the script name:

  trigger:
    platform: event
    event_type: ios.notification_action_fired
  action:
  - service_template: >
      script.{{ trigger.event.data.actionName.toLowerCase() }}

But HA does not like toLowerCase() in this scenario. There is probably an easy fix. I just don’t know what it is. Thoughts?

Hi! Hello! Hey there!!!