I have recently updated our restmon schemas to include alarm_name and alarm_description fields, which we can then use in situations and notifications.
These fields are based on a javascript function:
"alarm_name" : "#function(){$alarmname = (root.alarm_name || root.alertcode || root.message); return $alarmname+' -- '+$alertid}();",
"alarm_description" : "#function(){$alarmname = (root.alarm_name || root.alertcode || root.message); return 'https://<URL>/'+$alarmname}();"
However, sometimes the alarm attributes contain the javascript rather than the desired content.
Using root.alertid instead of $alertid in the javascript resolved the issue.