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

Dave DusekThe 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 Secure Link) 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, https://opensource.org/licenses/ms-pl.html.)