Monday, 1 December 2014

Add Events for form field on web event handler

Blackbaud CRM 

I have made a web event handler, in this web event handler, i need to grab the event of any field. For instance if use “Enhance Event Handler” . In this event handler, I want to change any field value or want to do any sort of change whether to select data from database, anything I want then the first question arises in my mind how I can handle the vent handler. See below lines taken from web event handler

Private Sub BatchCommitmentUpdateHandler_AfterLoad(sender As Object, e As EventArgs) Handles Me.AfterLoad
        With Me.FieldChangedHandlers
            '' If Commitment lookup id is selected then it will get the commitment details from the DATAFORMID_COMMITMETINFO
            ''form and load all single values along with the collection values
            If FieldIsDefined("CONSTITUENTID") Then
                .Add("PRIMARYRECORDID", AddressOf GetConstituentExtensionData)
            End If
        End With
    End Sub

Private Sub GetConstituentExtensionData (ByVal e As FieldEventArgBase)
‘ Implement the custom logic here
End Sub

Now if you debug the batch event handler whenever you change any constituent, it will push the implementation into the “GetConstituentExtensionData” method. And in this method you can do anything you want.
There is another event “CellChanged” event in web event handler, using this event, you can also accomplish this thing but according to it will cause extra overhead on implementation because this event will trigger when user will change any event and check for every field. So the best way to define the event in webevent handler is the above one.


No comments:

Post a Comment