another blog


About Microsoft Dynamics GP :-)

VSTools and database triggers.

In SanScript coding we have database triggers, Below is a detail of what database triggers are as explained in dexterity manuals.

Database triggers
Database triggers are activated by successful table operations, such as a record
begin read, saved, or deleted. The procedure that runs in response to a database
trigger has access to the same table buffer contents as the script that performed the
database operation.Database triggers are useful for maintaining referential integrity between records in
your application and related records in the accounting system. When Microsoft
Dynamics GP reads, saves or deletes a record, you can use a database trigger to
perform similar operations for a related table in your application.


While working with VSTools, one surely miss equivalent event in VSTools customization. The resources for which we  can register events are such as forms, windows,and fields. While working with custom tables to save additional information related to the any GP window, we need to make sure about the integrity of data, so if records get saved/delete in GP table it’s corresponding record must be save/delete from the custom table.

For a situation like that I register event trigger against  AddRecordDeletedRecord procedure.

 Microsoft.Dexterity.Applications.Dynamics.Procedures.AddRecordDeletedRecord.InvokeAfterOriginal += AddRecordDeletedRecord_InvokeAfterOriginal;

private void AddRecordDeletedRecord_InvokeAfterOriginal(object sender, AddRecordDeletedRecordProcedure.InvokeEventArgs e)
if ((e.inParam1 == “GL_TRX_HDR_WORK”) &&
(e.inParam2 == DynamicsModified.Forms.GlTransactionEntry.GlTransactionEntry.JournalEntry.Value.ToString()) &&
(e.inParam3 == 2) &&
(e.inParam4 == 0))
//delete record from custom table


This procedure gets call from many GP windows and on several time, so that’s why I added if condition to check if I am correctly removing the record.



Filed under: Dexterity Triggers, Dynamics GP, dynamics-gp, VSTools

Leave a Reply

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

%d bloggers like this: