Start a new topic

Access ID of new constituent from within BeforeGiftSave

Hi,

New to IOM, but already loving the API.

At my organisation, we use a persons constituent ID to generate a reference number for their direct debit (recurring gift). When we imported new constituents separately from new gifts, we would already know the constituent ID by the time the gift was imported. We could therefore simply concatenate it with a prefix ("AZ") in excel prior to the gift import. Now, although a single-step import is more convenient, there doesn't appear to be an easy way to accomplish this.

If the ID of the newly created constituent were available at the "BeforeGiftSave" stage of the import, I could generate the gift reference on the fly.

Is this possible? How can I get hold of the constituent ID from within BeforeGiftSave?

Cheers,
Tom


Hi Tom!

If you have the constituent ID in the import file already then you can make a virtual column and a custom function that would simply take that ID and add "AZ" to the front. But I think that you don't have the ID in the import file.

In that case I would actually do this in AfterConstituentOpen since it is easier to get the ID there. Just make a virtual column that links to your reference number field and set the function to -BLANK-

Then in the code editor you want to add the AfterConstituentOpen sub by typing "Public Override AfterConstituentOpen" (it should fill in the rest for you). In that sub you can reference oRec which is the record of the matched constituent. Then it is simply a matter of getting their constituent ID with a call that is something like:
oRec.Fields(Import.API.Blackbaud.ERecordsFields.ConstituentID)
NOTE: THE ABOVE IS PSEUDO CODE!

To find out the exact text of the field reference you should look in the Help folder of your RE installation for a file called RESolutions.chm search for CRecords to get started!
Hi Tom,

You can also go to the Gifts area of the profile and check the box to "Populate blank direct debit reference or cc authorization with constituent id and AZ". This will give you a reference of AZ1234. This works for new or existing constituents.

Test that with one or two rows and see if that's what you'd like to happen.

Thanks,
Amanda
Omatic Support
Nice Amanda!
How annoying! How will I justify messing around in the API if Omatic make everything so easy?

I'm sure that your suggestion will come in handy at some point Wayne. Thanks very much for sharing.

And thanks again to Amanda - you've really helped me out today.
Login or Signup to post a comment