Best of 2021: Idle Record Release

By Daniel Wood, 23 December 2021

idle release teaser

When Users Hold Records

The last of my 2021 Best Ofs is a couple of scripts to help with those pesky users who leave records uncommitted and then bugger off for a coffee or take a long lunch break. Super annoying for other users and for you as a developer if you wish to make a field definition change on a production version — hey, it happens, deal with it!

We facilitate the commit of an iDLE user through an OnTimer installed for each individual user. The OnTimer is running a script that will monitor the users active field (if there is one) and determine if they are idle in that field. 

This is done by storing information about the users last active field in a global variable repetition. We use different repetitions for multiple windows the user may have open to track states of multiple windows.

Information we capture about the users field include:

  • Active field name
  • Active field contents
  • Record Modification Count
  • Record Open Count
  • Record Open State

top 5 of 2021 9

All of this information is stored in the variable. If the next time the OnTimer runs none of this information has changed then the record is committed. 

For example we might wish to set our onTimer to 30 seconds. By doing so will allow a user to sit idle in a field making no modifications for no more than 30 seconds. If they are typing in the field then the stored information will differ from the previous time it was run and so the user is free to continue without the threat of a commit happening.

The technique uses a script to enable the idle release timer, one to disable, and one to carry out the commit.

The enable script allows you to define your own terms for when the IDLE release process is to be installed.  This is useful because as a developer having this OnTimer run can be painful as it will jump the developer out of active script steps you may be writing in.  So we disable this for full access users.  There is also little need to run this if executing on server.  Certain windows are only spawned for temporary purposes such as carrying out actions in a script. In this case you may wish to not use idle release for these types of windows.

Example File Download

Something to say? Post a comment...


  • Paul Jansen 14/02/2022 6:44am (2 years ago)

    Nice implementation. My preference would be to use a JSON object for each window.

    Let ( [
    ~window = Get ( WindowName ) ;
    ~lastActivity = JSONGetElement ( $$Activity ; ~window ) ;
    ~newActivity = JSONSetElement ( "{}"
    ; [ "AFN" ; Get ( ActiveFieldName ) ; JSONString ]
    ; [ "AFC" ; Get ( ActiveFieldContents ) ; JSONString ]
    ; [ ".RMC" ; Get ( RecordModificationCount ) ; JSONString ]
    ; [ "ROC" ; Get ( RecordOpenCount ) ; JSONString ]
    ; [ ".ROS" ; Get ( RecordOpenState ) ; JSONString ]
    ) ;
    $$Activity = JSONSetElement ( $$Activity ; ~window ; ~newActivity ; JSONObject )
    ] ;
    ~lastActivity = ~newActivity

RSS feed for comments on this page | RSS feed for all comments

Categories(show all)


No Tags