Due to scheduled maintenance, some areas of our site are currently inaccessible. Thank you for your patience.

Please reach out to sales@eonesolutions.com with any questions.

Back

Applying GP Payables Documents in SmartConnect Integrations

Published: Nov 29, 2023
Post Author Written by Ethan Sorenson

SmartConnect uses Microsoft’s eConnect API to send data to Dynamics GP, which means the data available for update from SmartConnect are based on what is provided through eConnect.

Applying payables transactions is not available in the standard eConnect API, but Precipio Services, has created DLL with all the business logic for applying Payables documents. This means we can now use a .NET Script Task within SmartConnect to call a DLL that will apply Payables Documents. Before proceeding with the steps in this article, the DLL will need to be purchased from Precipio Services directly.

For more information about what data SmartConnect can integrate into, please reference this help article.

Setup

There are a few setup items required for SmartConnect to be able to use the AP Payment API from Precipio Services which will only work with SmartConnect 2014 or higher.

These steps will have to be completed for each location where SmartConnect is running. Any machine running the User Interface, Web Service or Windows Service will need to go through this setup.

Precipio DLL

Copy the Copy the Precipion.APApply.dll to the following folder locations based on your SmartConnect version.

Item 2 will only be needed if the maps will be executed from the SmartConnect web services.

  1. C:\Program Files\eOne Solutions\SmartConnect (include any location where SmartConnect has been installed)
  2. C:\Program Files\eOne Solutions\SmartConnect API\bin (wherever the SmartConnect WCF Web Service is installed)
  3. C:\Windows\SysWOW64 (on machine where the SmartConnect Windows Service has been installed)
  4. C:\Windows\Microsoft.NET\Framework64\v4.0.30319

Items 2 and 3 will only be needed if the maps will be executed from the SmartConnect web services.

  1. C:\Program Files (x86)\eOne Solutions\SmartConnect (include any location where SmartConnect has been installed)
  2. C:\Program Files (x86)\eOne Solutions\wcf\bin (wherever the SmartConnect WCF Web Service is installed)
  3. C:\Program Files (x86)\eOne Solutions\www\bin (wherever the SmartConnect Web Service is installed)
  4. C:\Windows\SysWOW64 (on machine where the SmartConnect Windows Service has been installed)
  5. C:\Windows\Microsoft.NET\Framework\v4.0.30319

Script Namespace

Before SmartConnect can call the new DLL, the namespace needs to be added to SmartConnect with the following steps.

  1. Open SmartConnect
  2. Navigate to File > Maintenance > Script Namespaces
  3. In the Assembly Name field enter Precipio.APApply
  4. Tab out of the field
  5. Click on the Precipio.APApply namespace in the Namespace(s) list
  6. Click Add Selected
  7. Click OK
  8. Close and reopen SmartConnect
  1. Open SmartConnect
  2. Navigate to Maintenance > Generic Connector > Script Name Spaces
  3. In the Assembly Name field enter Precipio.APApply
  4. Tab out of the field
  5. Click on the Precipio.APApply namespace in the Namespace(s) list
  6. Click Add Selected
  7. Click OK
  8. Close and reopen SmartConnect

Integration Mapping

Now we can reference the new DLL in the integration mapping.

Data Source

We are using a simple data source from a CSV (comma separated values) file with the basic information required.

We are mapping the VendorId, DocDate, PaymentNumber, ApplyDocumentNumber and the ApplyAmount.

We will use the PaymentNumber as my Key Field for each new document to create.

The ApplyDocumentNumber is the vendor document number used to find the payables document in the open table.

The assumption in this integration is the Apply Amount will be the Payment Amount.

Destination

Our destination is Microsoft Dynamics GP with the Group of Payables and Node Type of Manual Checks.

We are only mapping the Create manual check node.

To get the next Payables Check Number, we will create a Dynamics GP Rolling Column.

We are mapping only the required fields for the destination. For required parameters that aren’t part of my data source, we use a combination of local constants and List Options to hardcode those values.

Task

Since we can only use this to apply one document at a time, the task we will create is a Run Script Task that will execute when the Document Succeeds.

The script task will initialize the apply process. If that is successful, it will make the call to the Apply Payment method.

dim success as boolean
dim errorResult as boolean
dim errorCode as integer
dim responseMessage as string
dim licenseKey as string
dim serverInstance as string
dim userConnectType as string
dim userID as string
dim userPassword as string
dim companyDatabase as string
dim documentType as string
dim apApplyTest as new Precipio.APApply.Import()


licenseKey = "mykey"     'Retrieved from Precipio Services
serverInstance = "eone-2014eone"
userConnectType = "SQL"    'SQL or GP 
userID = "sa"
userPassword = "pass@word1"
companyDatabase = "TWO"


'Initialize the license
success = apApplyTest.Initialize(licenseKey, serverInstance, userConnectType, userID, userPassword, responseMessage)

'Display a message if the initialize fails. Only use this if running manually
if not success then
  MessageBox.Show("Initialize: " & responseMessage)
  return false
end if



'Apply the Payment that was just integrated to a voucher
documentType = "PAYMENT" 'PAYMENT or CREDIT

success = apApplyTest.ApplyPayment(companyDatabase, _VENDORID, Convert.ToDateTime(_DOCDATE), documentType, _PAYMENTNUMBER, _APPLYDOCUMENTNUMBER, _APPLYAMOUNT, errorResult, errorCode, responseMessage)

if not success then
  MessageBox.Show("Apply: " & responseMessage)
  return false
else if errorResult then
  MessageBox.Show("Apply: " & responseMessage)
  return false
end if

apApplyTest = nothing

return true
bool success = false;
bool errorResult = false;
int errorCode = 0;
string responseMessage = null;
string licenseKey = null;
string serverInstance = null;
string userConnectType = null;
string userID = null;
string userPassword = null;
string companyDatabase = null;
string documentType = null;
Precipio.APApply.Import apApplyTest = new Precipio.APApply.Import();

licenseKey = "mykey";
//Retrieved from Precipio Services
serverInstance = "eone-2014\eone";
userConnectType = "SQL";
//SQL or GP 
userID = "sa";
userPassword = "pass@word1";
companyDatabase = "TWO";

//Initialize the license
success = apApplyTest.Initialize(licenseKey, serverInstance, userConnectType, userID, userPassword, responseMessage);

//Display a message if the initialize fails. Only use this if running manually
if (!success) {
  MessageBox.Show("Initialize: " + responseMessage);
  return false;
}

//Apply the Payment that was just integrated to a voucher
documentType = "PAYMENT";
//PAYMENT or CREDIT
success = apApplyTest.ApplyPayment(companyDatabase, _VENDORID, 
              Convert.ToDateTime(_DOCDATE), documentType, _PAYMENTNUMBER, 
              _APPLYDOCUMENTNUMBER, _APPLYAMOUNT, errorResult, errorCode, responseMessage);

if (!success) {
  MessageBox.Show("Apply: " + responseMessage);
  return false;
} else if (errorResult) {
  MessageBox.Show("Apply: " + responseMessage);
  return false;
}

apApplyTest = null;
return true;

Map Execution

When the map executes, as each Payables Manual Check is created, the post document success task will apply the Check to the Voucher. If the document fails to be created, the apply task will not be attempted.

Caveats

This is a list of items to consider when using this method to apply payables documents

  • Documents being applied to must be posted and in the Payables Open table.
  • This process does not handle Multi Currency transactions.
  • The import of the document may be successful while the apply task fails, in that case it can then be applied manually.

Feeling stuck? Get the support and guidance you need to help you power through any data challenge

We're on your integration team. Connect with our people and let us know how we can help you.