# event.setGlobal not working?

**URL:** <https://forum.inductiveautomation.com/t/event-setglobal-not-working/59299>\
**Category:** Ignition\
**Tags:** ignition80\
**Created:** [May 6, 2022, 2:24pm UTC](https://forum.inductiveautomation.com/t/event-setglobal-not-working/59299 "2022-05-06T14:24:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![liam1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@liam1](https://forum.inductiveautomation.com/u/liam1)\
**Post date:** [May 6, 2022, 2:24pm UTC](https://forum.inductiveautomation.com/t/event-setglobal-not-working/59299/1 "2022-05-06T14:24:30Z")

</div>

Hi all,

In the notification pipeline I’m trying to add a property to the event.

I’m using the event.setGlobal() method to add the property and set a value.

After the first loop the code exutes correctly and the property is added to the event (checked using system.util.logger).

The event does not exit the pipeline but on the second cycle after a delay the property is not on the event instance.

Is this the correct method of check if the property exist on an event instance?

```auto
if 'MessageCount' not in event.properties:
    event.setGlobal('MessageCount',1)

```

Can someone explain what I am doing wrong?

---

<div class="post-metadata">

**Author:** ![obober](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/obober/32/67865_2.png) [@obober](https://forum.inductiveautomation.com/u/obober)\
**Post date:** [May 6, 2022, 7:13pm UTC](https://forum.inductiveautomation.com/t/event-setglobal-not-working/59299/2 "2022-05-06T19:13:26Z")

</div>

The `event.properties` object is not a Python list of Strings, but rather a Java [HashSet](https://docs.oracle.com/javase/7/docs/api/java/util/HashSet.html) of Ignition Alarm objects. As such, you cannot use the Python `in` operator with a String to test if your property is in that set because the `HashSet` doesn’t contain Strings. Instead, you can iterate through the `HashSet` and check if the expected property is there. Here is an example of the code I have added to my script block in an alarm notification pipeline to achieve this:

```auto
myLogger = system.util.logger("myLogger")
for property in event.properties:
	if str(property) == 'activeTime':
		myLogger.info("Found property!")

```

Obviously, for your use case, you would swap ‘activeTime’ with ‘MessageCount’.

---

<div class="post-metadata">

**Author:** ![liam1](https://avatars.discourse-cdn.com/v4/letter/l/e68b1a/32.png) [@liam1](https://forum.inductiveautomation.com/u/liam1)\
**Post date:** [May 10, 2022, 2:18pm UTC](https://forum.inductiveautomation.com/t/event-setglobal-not-working/59299/3 "2022-05-10T14:18:42Z")

</div>

Thanks this worked
