'This procedure will be called before a record of the specified type is saved
Public Sub Action_BeforeSave(oRecord As Object, bCancel As Boolean)
    'oRecord              : record object being saved
    'bCancel              : set to true to cancel the save operation

    Dim oAction As CAction
    Dim oAct As CAction
    Dim oActs As CConstituentActions
    On Error GoTo ErrHandler
    Set oAction = oRecord
    Dim sProposalID As String
    sProposalID = ""
    Dim oConstit As CRecord
    Dim sMsg As String
    'If the action is tied to a proposal, save the proposal ID, surface the constit record, and loop actions tied to proposal
    If Not oAction Is Nothing Then
        If Not oAction.Fields(ACTION_fld_PROPOSAL_ID) = sProposalID Then
            sProposalID = oAction.Fields(ACTION_fld_PROPOSAL_ID)
            Set oConstit = oAction.Constituent
            Set oActs = oConstit.Actions
            'Loop all constit actions
            For Each oAct In oActs
                If oAct.Fields(ACTION_fld_PROPOSAL_ID) = sProposalID Then
                    sMsg = sMsg & oAct.Fields(ACTION_fld_ID) & vbCrLf
                End If
            Next oAct
            'Show results.  With the above, it's all action IDs that are tied to proposal.
            MsgBox sMsg
        End If
        'bCancel = < place your custom save criteria here >
    End If
    Set oAction = Nothing
    Set oAct = Nothing
    Set oActs = Nothing
    Set oConstit = Nothing
    On Error GoTo 0
    Exit Sub
    Dim sErr As String
    sErr = Err.Description
    On Error GoTo 0
    '< place your custom error handling code here >
    MsgBox "Error processing Action_BeforeSave : " & sErr
    Set oAction = Nothing
    bCancel = False
    Exit Sub

End Sub

Disclaimer: We provide programming examples for illustration only, without warranty either expressed or implied, including, but not limited to, the implied warranties of merchantability and/or fitness for a particular purpose. This article assumes you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures. Our Customer Support can help explain the functionality of a particular procedure, but we will not modify, or assist you with modifying, these examples to provide additional functionality. If you are interested in learning more about the VBA and API modules, contact your account manager.