How to modify the Safepay Transactions upload window to allow macros to run

Dave Dusek - Click for blog homepageThis is a reposting of an article Dave Dusek originally wrote on my Developing for Dynamics GP blog.

The following is a situation that I have come across a couple of different times.  What people want to do is set up a macro to run at night to generate their Safepay EFT file.  They want to just set it up to run every night whether there are transactions to process or not.

The problem comes in when there are no transactions to process.

  1. The user would record a macro to log into GP (see KB 855677) and go to the Safepay Transactions Upload window.
  2. In the window, the macro would select the Bank ID and then click Load/Reload Transactions button to fill the window.
  3. Then the macro would click the Upload button to generate the EFT file.  When there are transactions to upload, you receive a message that asks if you would like to upload transactions.  The macro would click proceed and after the file is generated, you receive a warning statement that the file has been generated.
  4. The macro would then click ok.  Another warning messge comes up that tells you to get a confirmation number.  The macro would click ok there and then put in the confirmation number.

You get the idea here, the macro recorded deals with multiple warning dialogs on a successful upload,  In the case where there are no transactions to upload, when the Upload button is clicked, you get a warning that there are no transactions to process and the upload aborts.

As you can see one macro won’t work in both of the above scenarios.  If there are no transactions to upload, the macro crashes and then will just sit logged into GP.  So that’s the situation we are trying to avoid.

When the Upload button script runs, it checks the ‘(L) Number of Checks’ local field on the window ME_PP_Transactions of form ME_PP_Transactions and if that is zero, then it gives the warning that there are no transactions to upload.  So what we can do to trick the system is put a focus trigger on the Upload button and if the field ‘(L) Number of Checks’  is zero, just simply set it to 1.  When you do that, all the windows come up as normally when there are transactions to process.  The only difference is that you just get an empty text file.  What this allows us to do now is have one macro log in and run at night and always work whether there are transactions to upload or not.

Here is the Dexterity code that I used to accomplish this and a partner also used VSTools to get the same result.  VBA doesn’t work because the ‘(L) Number of Checks’  field is disabled on the window, unless you wanted to use the unsupported method of running sanScript from VBA.    

Example Dexterity Code – This is the trigger processing procedure on a cross dictionary focus trigger on the Upload button in Safepay.  This trigger runs before original. 

local text code;
local string compiler_error;

{Build the pass-through sanScript code.}
code = code + "if empty('(L) Number of Checks' of window ME_PP_Transactions of form ME_PP_Transactions) then ";
code = code + " set '(L) Number of Checks' of window ME_PP_Transactions of form ME_PP_Transactions to 1; ";
code = code + "end if; ";

{Execute the code.}
if execute(1235,code, compiler_error) <> 0 then
  {A compiler error occurred. Display the error.}
  error compiler_error;
end if;

Hope you find this useful.

Dave Dusek
Dynamics GP Developer Support

// Copyright © Microsoft Corporation.  All Rights Reserved.
// This code released under the terms of the
// Microsoft Public License (MS-PL,

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

4 thoughts on “How to modify the Safepay Transactions upload window to allow macros to run

  1. How do you setup the security to run a macro?  I get an error that the user doesn’t have the rights to run a macro.  I can’t seem to find where that security would be set.


  2. Hi Sue
    There is no actual security setting on macros in Dynamics GP.  This sounds more like a file permission issue at the operating system level.
    What is the exact wording of the message and when does it occur?


  3. Dave,
    I realize this blog from you is from a few years ago. However, I am just now attempting to add this script in order to automate our Safe Pay upload. I've installed Dexterity 11.0, copied the SFPAY.DIC to Dexterity, and added the script that you've provided. Now, how do you recommend that I test it, and then move it to our production environment?
    Thank you sir,


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.