Microsoft Dynamics GP 2016 Cookbook
上QQ阅读APP看书,第一时间看更新

Automating processes with macros

Macros provide a way to automate processes within Dynamics GP. They are actually very easy to create and use. Macros are perfect for moderately complex but repetitive processes. For example, a cash transfer between bank accounts is a common repetitive task but there is some complexity to it because the amount is usually different. This example provides a great, practical lesson in macros, so we'll look at it in this recipe.

How to do it...

To create a macro for a bank transfer, follow these steps:

  1. From the Microsoft Dynamics GP menu, select Tools | Macro | Record…:
  2. Note where the macro is being saved and name the macro Bank Xfer.
  3. Select Financial on the Navigation pane and pick Bank Transfers from the Financial area page under Transactions. Click Save.
  4. Tab to the Description field and type Bank Transfer.
  5. Enter UPTOWN TRUST in the Checkbook ID field to transfer from. Leave the amount set to zero (0).
  6. Enter FIRST BANK in the CheckBook ID field to be transferred to:
  7. From the Tools menu select Macro | Stop Record. Click Clear and close the Bank Transfer Entry window.
  8. Now, select the Microsoft Dynamics GP menu item then pick Tools | Macro | Play.
  9. Find and select the Bank Xfer macro saved earlier and click Open.
  10. The macro will run. As the macro runs, the Bank Transfer Entry window will open and the description, to and from accounts will fill in automatically. The window will then be left open for a user to add the transfer amount. Click Post when finished, to complete the transfer.

How it works...

Recording a macro is easy. Macros can be recorded by any user with proper security and because they are stored as a file, they can be shared among users. There are an infinite number of uses for macros. They can be reused or built only for a specific scenario. Learning to create and run macros provides a terrific opportunity to automate any number of functions in Dynamics GP.

There's more...

Macros can be attached to the shortcut bar and run from there. They can also be run with a keystroke combination. Finally, users can insert pauses in macros or string them together into a set of steps.

Macros can be made faster

Macros are very useful, but if you are using them to do a bulk update then they can take a while to run. Fortunately, there is a switch which can be added to the Dex.ini file (located by default in %ProgramFiles(x86)%\Microsoft Dynamics\GP2016\Data). To add the switch, open the Dex.ini file and, under the [General] title add the following and save the file:

ShowAdvancedMacroMenu=TRUE

Once the switch has been added, a new Advanced menu is added to the Macro menu. To use the additional functionality now available, follow these steps:

  1. On the Microsoft Dynamics GP menu, click Tools | Macro | Advanced | Status.
  2. Click the ellipsis button () and select the required macro.
  3. Click the No User Interface Flash checkbox:
  4. Click the OK button to run the macro.

You should notice that the macro runs at least twice as fast as the original; if you are using macros to integrate large amounts of data, the performance of the macro should be even better.

Macros and the shortcut bar

Macros can be added to the shortcut bar, making them easy to run with a single click.

Macros can be run with a keystroke combination

Once a macro has been added to the shortcut bar, a keystroke combination can be added, allowing it to be run from the keyboard.

Macro pauses

Pauses can be inserted into macros to allow for data entry in the middle of a macro. To insert a pause, click Tools | Macro | Insert Pause while recording a macro. A box will open, allowing the creation of instructions for the user. The problem with pausing macros is that the process to restart a macro is not intuitive. When a user executes a macro, the macro pauses at the selected point and waits for user input. After user input, the user must select Tools | Macro | Continue to resume the macro.

That set of steps is not obvious to a user. Also, there is not enough room to reasonably enter instructions and restart steps in the instruction box. Nor is there a keystroke combination to resume a macro after a pause.

Sequential macros

An alternative to pausing macros is to create more than one macro. Create the first macro up to the point where a pause would be inserted. Then create a second macro for the next portion of the process. Add the macros to the shortcut bar in a folder in the order they should be executed. After the first macro finishes, the user simply needs to insert any data required and click the second macro to continue the process.

See also...

  • The Remembering processes with an ad hoc workflow recipe in Chapter 2, Organizing Dynamics GP