Gateway Tag Change Script getPreviousValue() errors?

I’m trying to get the previous value on the tag before it changed and . .
All my attempts to use getPreviousValue().getValue() generate errors

I read through posts like these where getPreviousValue().getValue() is mentioned
change-script-triggered-with-no-reason
gateway-tag-change-script-issue
yet when I try to run getPreviousValue().getValue() in a script I receive the error ‘NoneType’ object has no attribute 'getValue’

Also, looking at getPreviousValue() in the documentation below
Gateway Event Scripts Overview
and when I run getPreviousValue() I see the error ‘getPreviousValue’ is not defined

What is the correct way to get the previous value? Or perhaps I’m overlooking something obvious?

It doesn’t exist when initialChange is true. So it is null or None and has no .value property. Either check the initialChange flag or check for None.

1 Like

That must be the cause of my problem then. I’m triggering the event by saving the script

1 Like