# Appending text to custom message inside of the alarm pipeline

**URL:** <https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141>\
**Category:** Ignition\
**Created:** [June 6, 2025, 7:26pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141 "2025-06-06T19:26:31Z")\
**Posts on this page:** 13\
**Page:** 1

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 7:26pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/1 "2025-06-06T19:26:31Z")

</div>

Is it possible to append additional text to a tags custom sms message inside of the pipeline using a script block?

The scenario is I would like to append a message to the text that says "reply STOP to unsubscribe" to any custom sms message that hits the alarm pipeline. If I cant do it this way I will have to write a script to roll thru every tag in the system. I can definitely do that but obviously the script block would be easier.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 6, 2025, 7:59pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/2 "2025-06-06T19:59:01Z")

</div>

As you said, you can use a script block.  
Alarm event are basically dictionaries. I don't remember the exact key, but it shouldn't be too hard to find.  
Once found, you can modify it.

But the easiest way... would be to just add it to the notification block.  
Any reason you can't do that ?

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 8:22pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/3 "2025-06-06T20:22:15Z")

</div>

It was my understanding that if you used a custom message on the tag that the message portion in the sms notification block wouldnt be used.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 6, 2025, 8:31pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/4 "2025-06-06T20:31:09Z")

</div>

I seem to remember being able to use the custom message in the notification block and adding stuff to it, but I could be mistaken, it's been long since I've done this.

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 8:33pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/5 "2025-06-06T20:33:18Z")

</div>

the manual states that the custom message on the tag supersedes any custom messages on notification blocks.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 6, 2025, 8:58pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/6 "2025-06-06T20:58:28Z")

</div>

Found it:  
`event['CustomSmsMessage']`

So I guess something like

```python
if event.get('CustomSmsMessage'):
    event['CustomMessage'] += "\nReply STOP to unsubscribe"

```

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 9:00pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/7 "2025-06-06T21:00:48Z")

</div>

I am able to get the custom message by using event['CustomSMSMessage'] but I cant update the message it doesnt seem unless I am not doing it properly.

```python
   logger = system.util.getLogger("myLogger")
	sms = event['CustomSMSMessage']
	newsms = sms + ' reply STOP to unsubscribe'
	event['CustomSMSMessage'] = newsms
	logger.info(sms)
	logger.info(newsms)

```

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 6, 2025, 9:04pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/8 "2025-06-06T21:04:00Z")

</div>

Worked for me.

Note that you should probably be using a `Set Property` Block instead of a script:

 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/4/8/48ce8bd4c21d00096847eb0ce254a7a1484d5dfd.png)

```python
if (!isNull({CustomSmsMessage}),
	{CustomSmsMessage} + '\n And More',
	null
)

```

Tried your exact script (copy pasted):  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/1/a/1aad992450911806d80787c6b6655614e36cd3a5.png)

Did you remember to save after editing ?

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 9:20pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/9 "2025-06-06T21:20:59Z")

</div>

> [@diat150](#):
>
> ```python
> logger = system.util.getLogger("myLogger")
> sms = event['CustomSMSMessage']
> newsms = sms + ' reply STOP to unsubscribe'
> event['CustomSMSMessage'] = newsms
> logger.info(sms)
> logger.info(newsms)
> 
> ```

so I swapped to using the set property block and the sms messages still didnt have the updated message. I then put the script block after the set property block and logged the result of event['customsmsmessage'] and it shows the updated message before it hits the notification block. so the notification block itself isnt respecting the updated customsmsmessage. weird.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2025, 9:36pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/10 "2025-06-06T21:36:13Z")

</div>

Try making the set property block `Global` instead of `Local`, or using `event.global["CustomSMSMessage"]` or whatever the syntax is.

---

<div class="post-metadata">

**Author:** ![pascal.fragnoud](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pascal.fragnoud/32/24728_2.png) [@pascal.fragnoud](https://forum.inductiveautomation.com/u/pascal.fragnoud)\
**Post date:** [June 6, 2025, 10:03pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/11 "2025-06-06T22:03:13Z")

</div>

If the prop is set with a "set property block", then a script block logs the correct value, why would a notification block not get that same updated value ?  
What does the global scope do to fix that ?

---

<div class="post-metadata">

**Author:** ![diat150](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@diat150](https://forum.inductiveautomation.com/u/diat150)\
**Post date:** [June 6, 2025, 10:15pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/12 "2025-06-06T22:15:35Z")

</div>

I tried using global but same result. it hits the logger and shows the appended text but the actual sms doesnt include the additional text

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [June 6, 2025, 10:42pm UTC](https://forum.inductiveautomation.com/t/appending-text-to-custom-message-inside-of-the-alarm-pipeline/107141/13 "2025-06-06T22:42:28Z")

</div>

I forget the exact minutiae (alarming isn't my area) but if I remember correctly "local" means basically "within this one pipeline execution", where "global" can mean "at a higher level that underlying Java code retrieving properties will use".

I can't really explain why this isn't working. The notification block should just be retrieving the property off the alarm event:

```python
String customMessage = notificationContext.getAlarmEvents().get(0).get(SmsProperties.CUSTOM_MESSAGE);

```
