Tuesday, November 15, 2011

How to use Macros & Scheduled Tasks to perform automated tasks for Microsoft Dynamics GP

In this topic  we will try  to shed light on how to take advantage of the Scheduled Tasks function provided by most operating systems which will  help the System Administrator to carry out the tasks entrusted to him.


in Great Plains  there are many of tasks which can be automated e.g. generating certain reports or run specific tasks such as check links. As example we will see how we can run the check links automatically using GP Macro &  Scheduled Task.



1-Create a Macro to run the Microsoft Dynamics GP:

·        Start the Microsoft Dynamics GP and before you enter the user ID & password click Alt+F8 to begin macro recording. System will show Name the Macro box , give proper name to the macro and save it in GP folder.
·        Continue with entering the user ID & password and select the login company and when you login Microsoft Dynamics GP click Alt+F8 to stop macro recording.

2-Create a Macro to execute the Task (e.g. check links) :
·        Login to  the Microsoft Dynamics GP.
·        Click Alt+F8 to begin macro recording, give proper name to the macro and save it in GP folder.
·        Select Microsoft Dynamics GP> Maintenance > Check Links> Finance > CM Setup & click OK.
·        Close the report.
·        Click Alt+F8 to stop macro recording.

3-Change the Macro Structure to stop the warning messages :

Sometimes the running macros show warning messages to the user , to stop those warning messages we can force the system to save those alerts in the log file rather than show it as warning messages.

Open the Macro files using any text editor program and add the following line to the top of macro file:

Logging file ':C: /TEST/LOGF.TXT '


This will save the alerts to log file LOGF.TXT located in the C\Test folder. You can change the path and file name and save it in proper location e.g. GP folder.

4-Create Batch File :

Batch is a text file that contains a sequence of commands which can allow user to execute commands or run applications etc.

To create the batch file open the notepad and add the following lines :

 dynamics dynamics.set XXX.mac
 cd C:\GP installation path
 dynamics dynamics.set XXX.mac

replace the XXX with macro name and GP installation path with actual GP folder:

dynamics dynamics.set Start.mac
cd C:\Program Files\Microsoft Dynamics\GP$GP10
dynamics dynamics.set Start.mac

Note:
·        when you try to save this file , select save as and select All file, the type file name and use bat extension ,because if you save directly it will be saved with txt extension.
·        You can check & test the batch file by double click on it.

5-Use Scheduled Task :

The last step is to automate the executing of the batch files , to do that we can use windows scheduled task:

Start>All Programs > Accessories\System Tools>Scheduled Tasks

Then double click on Add Scheduled Task and follow the wizard.


No comments:

Post a Comment

SSRS - How to Parameterizing the SQL Query

We need to create separated dataset to handle the pre defined list in that dataset we will use simple select statement to define the li...