Tuesday, 2 December 2014

Register event for Collection field in web event handler

Blackbaud CRM 

In last post I have mentioned how to register any event for any field in web event handler. I have a scenario to play with collection fields. I have 5 fields in single collection. And for instance, if I change 3rd field and based on this field change other field will have an impact . So in this case I need to register an event which will handle this. See below lines
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("XMLSTANDARDMETRIC") Then .Add("XMLSTANDARDMETRIC\AMOUNT", AddressOf StandardMetricAmountValidation)        End With
    End Sub

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

Now, whenever user will change 3rd field which is AMOUNT column in collection “XMLSTANDARDMETRIC” then it will enter into the method “StandardMetricAmountValidation” and in this method we can use custom implementation.



No comments:

Post a Comment