Monday, 1 December 2014

How to set the field properties dynamically when opening any batch

Blackbaud CRM 

To set the batch field properties dynamically when loading any batch, we need to use AfterLoad event of batch entry handler. Please see the below code snippet

Private Sub BatchCommitmentUpdateHandler_AfterLoad(sender As Object, e As EventArgs) Handles Me.AfterLoad
        With Me.FieldChangedHandlers
            'Disable fields if STATUSCODE is Unqualified
            If DirectCast(Me.DefaultFields, Blackbaud.AppFx.UIModeling.Core.UIModelFieldCollection).Item("STATUSCODE").ValueObject.ToString() = "0" Then
                DirectCast(Me.DefaultFields, Blackbaud.AppFx.UIModeling.Core.UIModelFieldCollection).Item("ASKDATE").Enabled = False
                DirectCast(Me.DefaultFields, Blackbaud.AppFx.UIModeling.Core.UIModelFieldCollection).Item("RESPONSEDATE").Enabled = False
                DirectCast(Me.DefaultFields, Blackbaud.AppFx.UIModeling.Core.UIModelFieldCollection).Item("ASKAMOUNT").Enabled = False
            End If

        End With
    End Sub

If you see  above code , I have added a condition that when Status code = “0” then all the below mentioned 3 fields are enable. So we can get the field from “Me” object rather than “e” .

No comments:

Post a Comment