Automatically send an email after a PanatrackerGP transaction

This article is a quick introduction to the capability of sending an email based upon details captured in a PanatrackerGP transaction. This is done by using PanatrackerGP’s nifty feature that extends our transaction-processing logic via our “Pre submit” or “Post submit” stored procedures. (Note these are something different than Microsoft’s eConnect’s pre/post procedures.)

First, you’ll need to configure your SQL Server to allow for the sending of emails. This is a native feature for SQL Server and may already be configured in your environment. The process differs slightly for each version of SQL Server, but the concepts are basically similar.

Next, create a stored procedure in your GP company database that PanatrackerGP will call at the start (or end) of our transaction workflow. It must contain the parameter “TrxOid” to identify our transaction record. Here’s an example of a simple procedure that we’ll call after we have updated GP for a fixed asset change:

In the example above, you will notice that we are using the TrxOid parameter as the identifier of a record in the PanatrackerGP database. We are getting that data by making use of database synonyms that are installed in the company database. We can then use information from that record to populate the body of the email message.

Lastly, configure PanatrackerGP to call the above stored procedure either before or after we tell Dynamics GP about the transaction data. You can set this from the PanatrackerGP portal’s Transaction Setup page. Look for your desired transaction in the grid and find the column for “Pre (or Post) Submit Stored Procedure”.

In our example here, we will edit the transaction setup for “Update Asset”, and paste in the name of the stored procedure we created above (i.e., “Panatrack_PostTrxUpdateAssetNotify”). When a transaction is submitted, PanatrackerGP will call that stored procedure and pass the TrxOid automatically. 

A permission may need to be configured in SQL to allow emails from your database server:

use msdb
grant exec on sp_send_dbmail to Panatracker

This has been a quick introduction to demonstrate the capabilities of this feature. Our professional services team would be happy to help you apply this in your own environment. 

Was this helpful?