' Get the Date of the Last Gift from the current record
Dim reLastGiftDate As Date = oLastGift.Fields(Blackbaud.PIA.RE7.BBREAPI.EGiftFields.GIFT_fld_Date)
Best Answer
J
John Shephard
said
almost 5 years ago
I couldn't get it to work either. It seems as the .RECORDS_fld_LAST_GIFT doesn't pull the correct gift. Even Blackbaud's KB doesn't reference first gift or last gift, they just have you sort. https://kb.blackbaud.com/articles/Article/43238 So I just did it this way instead
Public Overrides Sub AfterConstituentOpen(oRec As CRecord, Cancel As ImportOM.API.iCancel) MyBase.AfterConstituentOpen(oRec, Cancel)
Dim lastGiftDate as New Date If oRec.Gifts.Count > 0 Then
I couldn't get it to work either. It seems as the .RECORDS_fld_LAST_GIFT doesn't pull the correct gift. Even Blackbaud's KB doesn't reference first gift or last gift, they just have you sort. https://kb.blackbaud.com/articles/Article/43238 So I just did it this way instead
Public Overrides Sub AfterConstituentOpen(oRec As CRecord, Cancel As ImportOM.API.iCancel) MyBase.AfterConstituentOpen(oRec, Cancel)
Dim lastGiftDate as New Date If oRec.Gifts.Count > 0 Then
Jack Scott
Hi,
I'm trying to use the answer given here:
https://omaticsoftware.freshdesk.com/support/discussions/topics/28000006750
...to pull through the Last Gift details for a record. (I want to change the coding on a donation on import if the last gift was within two years.)
However, it doesn't seem to be working for me.
Can anyone tell me why the below wouldn't assign the correct Last Gift Date to reLastGiftDate?
========================
Public Overrides Sub AfterConstituentOpen(ByVal oRec As Blackbaud.PIA.RE7.BBREAPI.CRecord, ByVal Cancel As ImportOM.API.iCancel)
MyBase.AfterConstituentOpen(oRec, Cancel)
' Get the RE last gift date and check it against the incoming gift date
' If the RE last gift date less than 2 years ago, then change coding
' Get the Last Gift from the current RE Record
Dim oLastGift As New blackbaud.PIA.RE7.BBREAPI.CGiftClass
With oLastGift
.Init(Import.SessionContext)
' **NOTE** this might fail if there is not a last gift so you should probably put in some error checking
.Load(oRec.Fields(Blackbaud.PIA.RE7.BBREAPI.ERECORDSFields.RECORDS_fld_LAST_GIFT))
End With
' Get the Date of the Last Gift from the current record
Dim reLastGiftDate As Date = oLastGift.Fields(Blackbaud.PIA.RE7.BBREAPI.EGiftFields.GIFT_fld_Date)
I couldn't get it to work either. It seems as the .RECORDS_fld_LAST_GIFT doesn't pull the correct gift. Even Blackbaud's KB doesn't reference first gift or last gift, they just have you sort. https://kb.blackbaud.com/articles/Article/43238 So I just did it this way instead
Public Overrides Sub AfterConstituentOpen(oRec As CRecord, Cancel As ImportOM.API.iCancel)
MyBase.AfterConstituentOpen(oRec, Cancel)
Dim lastGiftDate as New Date
If oRec.Gifts.Count > 0 Then
With oRec.Gifts
.SortField = EGiftFields.GIFT_fld_Date
.SortOrder = bbSortOrders.Descending
lastGiftDate = .Item(1).Fields(EGiftFields.GIFT_fld_Date)
End With
End If
End Sub
Thanks,
John
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstJohn Shephard
I couldn't get it to work either. It seems as the .RECORDS_fld_LAST_GIFT doesn't pull the correct gift. Even Blackbaud's KB doesn't reference first gift or last gift, they just have you sort. https://kb.blackbaud.com/articles/Article/43238 So I just did it this way instead
Public Overrides Sub AfterConstituentOpen(oRec As CRecord, Cancel As ImportOM.API.iCancel)
MyBase.AfterConstituentOpen(oRec, Cancel)
Dim lastGiftDate as New Date
If oRec.Gifts.Count > 0 Then
With oRec.Gifts
.SortField = EGiftFields.GIFT_fld_Date
.SortOrder = bbSortOrders.Descending
lastGiftDate = .Item(1).Fields(EGiftFields.GIFT_fld_Date)
End With
End If
End Sub
Thanks,
John
Jack Scott
Amazing. John, thanks so much for this. My import is now working!
Thanks,
Jack
-
Running a query with an ASK operator from IOM API
-
Data Append for Employment
-
How to Display Business Rule Pop-Ups
-
Opening a Query in API
-
Virtual Field Name reference
-
Deleting Aliases
-
Setting constituent attribute conditionally
-
API Documentation
-
Individual Relationships
-
Treating someone differently if they're already an Event Participant
See all 183 topics