Scheduling MOGenerator

Overview

MOGenerator provides a number of useful Manufacturing integration utilities, such as the ability to create MOs, reschedule MOs, create child-MOs, and receive MOs.  Collectively these utilities will be referred to as MOGen in this post.

MOGen can be run manually, where it runs one time and processes all available records in the integration tables, and then stops.  Or, it can be run continuously.  When running continuously, it periodically polls the integration tables to see if there is anything to process.

When MOGen is part of a system integration, a common need is to have it run automatically on an unattended machine.  The steps below describe how a GP client can be configured to launch automatically everyday, run MOGen during business hours, then shut down.  The benefits of this process are that it ensures no GP clients remain connected to the SQL server during maintenance periods, and it provides for regular “refreshing” of the GP client (which tends to run better if it is regularly restarted).

 

Configuring MOGen

See the MOGen documentation for more information about this window.

Mark the box next to “Auto-start after login”.

All of the Timer settings are saved automatically, and reload when each time the window is opened.

The Timer must be ENABLED.

Stop After x-Hours.  Enter the number of hours the utility should run before it shuts down.  For example, 10-hours would calculate an end time 10-hours in the future from the moment the IMPORT button is clicked.

Close GP When Done.  MARK this box.  The macro discussed below will launch MOGen, when the stop time is reached, MOGen will stop processing and close GP.

If the utility will run overnight, add this setting to the DEX.INI file:

SuppressChangeDateDialog=TRUE

This setting keeps GP from popping the “Do you want to change the date” dialog at midnight.

Login Macro

If MOGen is going to be run on a dedicated GP client PC, or a VM that is not a shared GP instance, you can configure GP to remember the Username/password and Company.  These settings are stored in the DEX.INI file so they can only be used on a dedicated GP client.  If you can do this, skip the Login Macro information below.

The Login Macro will be used by Windows Scheduler to launch and log-in to Dynamics GP.  It then opens MOGen and clicks the Import button.

There are a few import sections of the macro.

The logging file entry:

Using a logging file keeps GP from popping up a dialog box when the macro finishes running.  The dialog box would interfere with MOGen, and also prevent GP from closing.  Set the path name to an appropriate location for your system.  A good place is in the GP\Data folder.

Username and password:

The Username and password are in plain text.

The next section of the macro selects a Company.  If you only have one company, or the MOGen user has access to only one company, remove these lines from the macro.

The next section of the macro opens the MOGen window and clicks the Import button.  If you have a newer build of the software that has the “Auto-start after login” option, remove these lines from the macro.

Selecting the company :

Edit the macro so that the “item 1” line selects the correct company from your login window:

As shown above “item 1” corresponds to “Fabrikam”, and “item 3” corresponds to “ZArchive”.  If you need “ZArchive” change the macro to “item 3”.

Download the MOGen login macro text file at the link below.  After downloading the file, change the extension to “.mac”.  Save the file into the GP Program folder, in the same location as DYNAMICS.EXE.

GPLoginMacroMOGen

Windows Scheduler

Use Windows Scheduler to create a Basic Task to “Start a program”.

The Program/Script is the path to DYNAMICS.EXE, such as

“c:\Program Files (x86)\Microsoft Dynamics\GP2016\DYNAMICS.EXE”

In the Add Argument field, enter:

DYNAMICS.SET GPLoginMacroMOGen.mac

If you can set GP to remember Username/password and Company, you do not need the Login Macro line above, just DYNAMICS.SET.

Set up the Task Schedule as desired.  The frequency with which the Task runs must be coordinated with the Timer Settings on MOGen to prevent launching GP before MOGen has closed GP from the previous run.

 

Monitoring MOGen

MOGen updates a record in a “heartbeat” table every time it runs.  So if MOGen is set to run once every 15 minutes, the heartbeat will be updated every 15 minutes.   The heartbeat table can be monitored to see if MOGen is still running–if it has quit updating the date/time stamp, it has quit running.

See the MOGen documentation for more information about monitoring MOGen remotely.