Products A-Z All Services Can't find what you're looking for? Chat Live!
Products A-Z Can't find what you're looking for? Chat Live!
Can't find what you're looking for? Chat Live!
Hello,
I'm pretty new to the RE API and I'm having difficulty doing something which seems like it should be simple on the surface, get the full CMembershipTransaction & CMembership object linked to a gift, including Gift of Membership. I can get to the CGiftMembTrans object, but I cannot figure out how to get from this to the true CMembershipTransaction. Any direction would be appreciated.
Matt
I don't see any really simple way of getting directly to the object. The nearest that I can come up with is this:
On the CGiftMemberTransaction object there is a field GIFTMEMTRANSACTION_fld_MemTransactionId. If you know that this is a current transaction and not a historical transaction you can load the membership object using the SQL where clause.The sql where clause points to the Membership view so you need to look at currentTransaction field of this view. See here for more information.
If you want to look at possible historical transaction then this may be more problematic. Since you have the gift you can open up the constituent. I think that you then need to go through all the membership objects on the constituent record (CConstitMemberships collection) and then loop the Transactions collection until you find the transaction id (from above). There may be a simpler way than this but this is my first thought.
David
David,
thanks for the reply. I actually was able to come up with a nice way to do this using the CGiftDataHelper, I'm including the code below in case anyone else runs into this issue...
Assuming reCurrentGift is CGift we want Membership for...
Dim dh As CGiftDataHelper Dim reGiftMemTran As CGiftMemTransaction Set reMembership = Nothing Set reMembTran = Nothing Set dh = New CGiftDataHelper dh.Init REApplication.SessionContext If reCurrentGift.MembershipTransactions.Count > 0 Then For Each reGiftMemTran In reCurrentGift.MembershipTransactions Set reMembership = New CMembership reMembership.Init REApplication.SessionContext reMembership.Load dh.Membership_GetMembershipIDForTransaction(reGiftMemTran.Fields(GIFTMEMTRANSACTION_fld_MemTransactionId)) Set reMembTran = reMembership.Transactions.Item(reGiftMemTran.Fields(GIFTMEMTRANSACTION_fld_MemTransactionId)) GoTo Located Next End If