New line in customized alarm notification

I’ve added an alarm to a Tag.

But how do I get a new line in my message (the text I type in “Display path” or “Custom message”? Now the text is 1 line while I want a couple of empty lines in my message.

\n Doesn’t work.

A little late, but I was trying to accomplish the same thing with SMS messages and found a solution so I figured I’d share. This only applies to the notification block inside of an alarm pipeline, not a custom message inside of the tag’s alarm configuration.

Create a script block in your pipeline and add the following:

event.set('newline', '\r\n')

Then in the notification block’s Message field you can add {newline} wherever you need a line break. For example:

[{eventTime|hh:mm:ss}]{newline}Alarm "{name}" at "{displayPath}" transitioned to {eventState}.
2 Likes

Thanks for this. I’m curious though - why does this work? Does using a {property} just escape the literal string interpretation of the message, while writing \r\n doesn’t?

That’s a great question and one I don’t have the answer to. My guess would be that the message field is stripped of invalid/unsupported characters or ignores escaped text before the {property} is evaluated.

1 Like