In GPAddins, add an event handler
AddHandler Dynamics.Forms.SopEntry.SopEntry.ActionButton.ValidateBeforeOriginal, AddressOf oSOPTransactionEntry.ActionValidateBeforeOriginal
And here is the actual event code
In this example, we're stopping the user from voiding if there is a payment.
Friend Sub ActionValidateBeforeOriginal(sender As Object, e As CancelEventArgs)
Dim strError As String = ""
Try
Select Case sender.value
Case 1'post
Case 2'transfer
Case 3'copy
Case 4'delete
Case 5 'void
Dim dblAmountReceived As Double = Dynamics.Forms.SopEntry.SopEntry.PaymentReceived.Value
If dblAmountReceived > 0 Then
Common.globalmessagebox("Unable to void, this document has a payment")
e.Cancel = True
End If
End Select
Catch ex As Exception
'error handling code
End Try
End Sub