Fund Missing (Found in an Unexpected Place)

I had an error that bugged me for a while when I could not work out what the problem was.

I had a list of gifts that I wanted to create on different constituents. I had the constituent id, the date, amount, fund, appeal, campaign, everything that I thought was required.

I got the following error message when trying to save the newly created gift:

Required Field Missing: Fund

I checked the file and there was a valid fund present for that gift. It was a fund that had been successfully used on other gifts. I stepped through the code but was not able to determine what the problem was.

It was only when I got another such gift and looked at what the gifts and the constituents had in common did I see the Matching Gift issue. I tried to add gifts manually to the constituents and noticed the matching gift screen came up.

If a constituent has an employer that matches gifts and if the constituent is set up to automatically match gifts then another gift will be created in the background with the match amount. However you would assume that if the gift is going to be created automatically then it should also be populated fully. Unfortunately this is not the case. The required fund field was left blank, hence the missing fund field error message.

How do you solve this? Well you either put the fund in, set up the matching gift so that it uses defaults or delete the matching gift. Here is an example (in VB.NET):

        Dim oMG As IBBMatchingGift  

        If oGift.MatchingGifts.Count > 0 Then  

            For Each oMG In oGift.MatchingGifts                'This line will default the matching gift to have the same  

                'field values as the gift given by the constituent  

                oMG.DefaultMGInfoFromGift()  

'If you just want to delete the matching gifts use the line below  

                'oGift.MatchingGifts.Remove(oMG)  

            Next oMG  

            oMG = Nothing  

        End If

You can of course change individual fields but why the values are not set to automatically default I will never understand.

2 thoughts on “Fund Missing (Found in an Unexpected Place)

  1. Thanks for the tip. I have been trying for a while to figure out why I can’t add a gift through the API for certain constituents. Haven’t tried your solution yet, but it sounds logical.

    Thanks again

Comments are closed.