Opening a Form after Logging into Microsoft Dynamics GP

David Meego - Click for blog homepageThis is a reposting of an article I originally wrote on my Developing for Dynamics GP blog.

As a follow on from the post last week on capturing the logging in and logging out events in Microsoft Dynamics GP, I want to cover how to open a form after logging into Microsoft Dynamics GP.  This could be a hidden form used by your code or a window that you want to open automatically.

Please refer to the previous post for the underlying scripts:

After Logging in, the system runs a number of processes in the background, such as the script which hides menu entries that a user does not have security access to.

We want our window to open after all the background processing is completed, so we need to use call background to add our command into the background queue.

Updated Set_Environment_Sub Global Procedure

{ Code to be run on login and returning from Report Writer/Modifier }

{ Put your code below here }
call background MBS_Open_Form;

{ Put your code above here }

MBS_Open_Form Global Procedure

{ Open form in Background }
open form <Name of Form here>;

Note: If this is for a hidden form, make sure that it has at least a main window (first window in list) on it which the following properties set. AutoOpen=False, Title=~internal~.  Otherwise, the hidden form will fail to open under the version 10.0 (and later) pessimistic security model.


This article was originally posted on the Developing for Dynamics GP Blog and has been reposted on

3 thoughts on “Opening a Form after Logging into Microsoft Dynamics GP

  1. David,
    This is good to know, but I also believe you should explain what is the difference between using command forms in the startup script and this method. Command forms allow developers to have hidden forms and windows opened in memory that can be accessed at anytime in the application.
    Mariano Gomez, MVP
    Maximum Global Business, LLC


  2. Hi Mariano
    You are correct, it would be possible to use a hidden window on a command form when you need access to window fields in your code.
    It depends on what you need.  Command forms open quite early and when be too early to open a window that a user will see, such as a setup or installation window or an automatically opening application window.
    I use this exact method to automatically open the Support Debugging Tool’s main window after logging in when the tool is in setup mode.


Please post feedback or comments

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.