Uidoc and documentcontext NOT BEING SET (old code)

My code is in an action button on the form.

So I am trying to get a handle on the current saved document but am receiving an error message when I use ws.currentdocument OR session.documentcontext.

This script used to work pre 8.5.

Why if I have the saved doc open can I not get a handle using ws.currentdocument. I set a new ws. Not even session.documentcontext.

how would I check uidoc.editmode then? weirdness.

Please help. THANKS!!