# Error running property change script

**URL:** <https://forum.inductiveautomation.com/t/error-running-property-change-script/59035>\
**Category:** Ignition\
**Created:** [April 29, 2022, 7:29am UTC](https://forum.inductiveautomation.com/t/error-running-property-change-script/59035 "2022-04-29T07:29:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [April 29, 2022, 7:29am UTC](https://forum.inductiveautomation.com/t/error-running-property-change-script/59035/1 "2022-04-29T07:29:29Z")

</div>

I have a property change script running on a view custom property as follows:

```auto
if previousValue.value > 0 and currentValue.value == 0:
	system.perspective.closeDock('alarmBanner')

```

The intention is, when the number of alarms shown in the alarm dock goes from \>0 to 0, I close the alarm dock. It works fine, but in the designer, every time I open the view, or every time the value changes, or every time I look at the change script, I get an error:

```auto
AttributeError: 'NoneType' object has no attribute 'value'

```

…which I would normally take to mean that either `previousValue` or `currentValue` are null - but these are arguments automatically generated by the change script, so I don’t see how they can be.

As I say - it works at runtime, I’m just wanting to understand why the designer repeatedly throws error messages at me.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [April 29, 2022, 1:49pm UTC](https://forum.inductiveautomation.com/t/error-running-property-change-script/59035/2 "2022-04-29T13:49:09Z")

</div>

`previousValue` is _ **always** _ `None` when the change event runs the first time (when `initialChange` is `True`).

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [April 30, 2022, 3:36am UTC](https://forum.inductiveautomation.com/t/error-running-property-change-script/59035/3 "2022-04-30T03:36:43Z")

</div>

Ah, so the value of that custom property isn’t maintained when I close and reopen the display in the designer then. And when I edit the change script, it’s presumably reset as well. That makes sense. So this presumably I just need to preface the entire thing with `if not initialChange:`

---

<div class="post-metadata">

**Author:** ![ASF](https://avatars.discourse-cdn.com/v4/letter/a/c4cdca/32.png) [@ASF](https://forum.inductiveautomation.com/u/ASF)\
**Post date:** [April 30, 2022, 3:53am UTC](https://forum.inductiveautomation.com/t/error-running-property-change-script/59035/4 "2022-04-30T03:53:08Z")

</div>

It appears that `initialChange` is not one of the available parameters on a custom property change script, only on a _tag_ change script. But `if previousValue is not None:` works just as well.
