Public Sub GetOriginalGift()

    Dim oMGPay As CGift
    Set oMGPay = New CGift
    oMGPay.Init REApplication.SessionContext
    oMGPay.Load 2077
   
    Dim lPledgeID As Long
   
    'Returns Matching Gift Pledge ID
    lPledgeID = oMGPay.PledgePayer.PledgeId(1)

    Dim oMGPledge As CGift
    Set oMGPledge = New CGift
    oMGPledge.Init REApplication.SessionContext
    oMGPledge.Load lPledgeID
   
    'System record ID for the source constituent of the matching gift
    Debug.Print oMGPledge.Fields(GIFT_fld_MG_Source_Constit_Id)
   
    oMGPledge.Closedown
    Set oMGPledge = Nothing
   
   
    oMGPay.Closedown
    Set oMGPay = Nothing

End Sub

Blackbaud provides 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 that you are familiar with Microsoft Visual Basic and the tools used to create and debug procedures.  Blackbaud Customer Support can help explain the functionality of a particular procedure but they will not modify, or assist you with modifying, these examples to provide additional functionality.  If you are interested in learning more about VBA and API modules, contact our Sales department at solutions@blackbaud.com.