Gateway scripting - previous value

Is there a way to get the Previous Value in a Gateway Event Script? the next line below is not working…

What doesn’t work about it?

Keep in mind the first time the script executes there is no previous value, so it will be null / Python None, which you need to check for before you try to access its value component.

It shows this Error

Ok, that’s caused by what I warned about.

You need to a check like this before accessing the previous value:

if event.getPreviousValue() is not None:
    # ... do stuff that requires the previous value 
1 Like

thanks that worked.

More generally, you can check the initialChange flag. When true, there won’t be a previous value.