NAV 2013 R2: Run trigger when leaving page?

I have a requirement that whenever the users either closes or leaves a purchase invoice, that a check is performed.

The page trigger onQueryClosePage is perfect for this, whenever the user closes the page.

But if the user doesn’t close the page, but just uses “Next” or “Previous” from within the page, then the check is not performed.

Any good ideas on how to perform the check in that case?

Ok solved it by using onQueryClosePage and coding it on the onNextRecord trigger.