D365 Finance & Operations and Dynamics AX Forum

Expand all | Collapse all

Automatically closing a form after 1 or 2 seconds

  • 1.  Automatically closing a form after 1 or 2 seconds

    Posted Jun 28, 2019 04:59 AM
    Hi,

    We have AX2012 R3 and are using Time and Attendance for our shopfloor workers to clock-in and out each day. Once they have entered there personnel number or scanned their badge the Clock-in Form appears as below.

    Clock-in Form
    We don't want the users to have to click OK as this could cause issues(we try to make this process as simple as possible) so we want the form to stay up for a second or 2 and then disappear ready for the next person. At the moment the form stays up for 6 seconds and then disappears with no user intervention.

    Can someone tell me where I can reduce this time to 1 or 2 seconds.

    Thanks in advance
    Fraser

    ------------------------------
    Fraser Kidd
    Livingston Precision Engineering (Ltd)
    Livingston SC
    ------------------------------


  • 2.  RE: Automatically closing a form after 1 or 2 seconds

    GOLD CONTRIBUTOR
    Posted Jul 01, 2019 10:31 AM
    No idea if there is any way to do that within AX, but what about using something like Auto-Hot Key to detect the window and close it after a few seconds? :)

    ------------------------------
    Gretchen Garcia
    IT Technician
    Denver Public Library
    Denver CO
    ------------------------------



  • 3.  RE: Automatically closing a form after 1 or 2 seconds

    TOP CONTRIBUTOR
    Posted Jul 02, 2019 09:15 AM
    Fraser,

    Do you know how you are currently making the form disappear? It is any custom code or native AX?

    I would think you would be able to override the init() method of the form put a sleep timer on it and close the form whenever you want by doing something like.

    public void init()
    {
        super();
        int seconds = 2;
        sleep(seconds*1000);
        element.close();
    }

    ------------------------------
    Alex Meyer
    Director of Dynamics AX/365 for Finance & Operations Development
    Fastpath
    Des Moines, IA
    ------------------------------



  • 4.  RE: Automatically closing a form after 1 or 2 seconds

    GOLD CONTRIBUTOR
    Posted Jul 02, 2019 12:47 PM
    My brief research suggests that the code to close the form after 6 seconds probably comes from the showClockInfo method of the JmgJobBundle class. This is the AX code in that method:

    /// <summary>
    /// Shows information about the clock in or clock out to the user.
    /// </summary>
    /// <param name="text">
    /// The text to show to the user.
    /// </param>
    private void showClockInfo(str text = messageText)
    {
    JmgDialogFormClass dlgForm;
    str infoText;
    if (showInfo)
    {
    infoText = text == "@SYS38409" ? "@SYS309981" : text == "@SYS38411" ? "@SYS309982" : '';
    dlgForm = new JmgDialogFormClass(infoText, text, "@SYS5473", true, 6000, this.parmCallerForm());
    dlgForm.openBreakDialog();
    }
    }

    The true on line 14 indicates that the form should close after a certain timeout period. The 6000 on that same line indicates that the timeout period should last for 6,000 milliseconds (6 seconds) before the form closes.

    Changing the 6000 to 2000 would accomplish that you desire (closing the form automatically after 2 seconds). But, it requires a code customization....

    ------------------------------
    Kirk Blackburn
    Engineer - Software Development
    The Church of Jesus Christ of Latter-day Saints
    Salt Lake City, UT
    ------------------------------



If you've found this thread useful, dive deeper into User Group community content by role