Sdílet prostřednictvím


Procedure events

Procedures provide the following events:

InvokeBeforeOriginal

This event occurs when the procedure is invoked, but before the original procedure is run. The event arguments allow access the parameters of the procedure. Refer to Parameters for procedures to learn more about working with parameters in procedure events.

InvokeAfterOriginal

This event occurs when the procedure is invoked, but after the original procedure is run.The event arguments allow access the parameters of the procedure. Refer to Parameters for procedures to learn more about working with parameters in procedure events.

The following C# example registers the InvokeAfterOriginal event for the AddSuccessfulLoginRecord procedure in Microsoft Dynamics GP.

Dynamics.Procedures.AddSuccessfulLoginRecord.InvokeAfterOriginal +=
new AddSuccessfulLoginRecordProcedure.InvokeEventHandler(
AddSuccessfulLoginRecord_InvokeAfterOriginal);

The following C# example is the event handler for the event registered in the previous example. The event handler for the AddSuccessfulLoginRecord procedure is typically used to perform setup operations, because the user has successfully logged into a company.

void AddSuccessfulLoginRecord_InvokeAfterOriginal(object sender, AddSuccessfulLoginRecordProcedure.InvokeEventArgs e)
{
    // Setup code is placed here
}