Start a new topic

API Solution for Importing Appeals to both main constituent and spouse with constituent ID

To anyone whom this may concern,

Coming to this forum was a bit of a last resort since it doesn't seem likely I'll receive a response, however, we are kind of out of options.

My supervisor and I are trying to develop piece of API code for an existing IOM profile we created to import constituent appeals to be updated, consisting of the constituent ID, Appeal, and Date added.  We want to be able to write a script that tells IOM that for each individual constituent in the appeal file, match it to the record in Raiser's edge, find a Spouse constituent ID (if one exists), and add the appeal ID and appeal date from the previous rows to the spouse constituent record.  The appeals are separated by file, so the appeal is the same for each ID in the file, along with the same date, so we would like to simply copy the appeal and date and add them to the spouse constituent record.  

In theory, this sounds like something that should be pretty basic, however, though I do have some coding experience, I am fairly new to VB, and it doesn't help that the API documentation for the IOM API is pretty vague about how each method and property is to be referenced. 

I can provide the pseudo code structure of what we think the API should do (I can also provide the profile mapping if necessary).  

I also have a question about if row parsing an import file is possible, kind of like range functions in Excel VBA (selecting a value from an active cell, and performing an If/Else function on a row-by-row basis, etc.).  If it is, that would assist in this endeavor tremendously.

If anyone reads this and can provide a bit of direction, it would be most appreciated.

Thank you,

~Marissa Roberson


--Code (or something resembling code hopefully) Starts Here--

'Import class libraries

Imports Microsoft.VisualBasic

Imports System

Imports System.Linq

Imports Blackbaud.PIA.RE7 


'Starts class for IOM Profile

Public Class Profile

    'Inherit Profile settings

    Inherits ImportOM.API.ProfileBase




    'Find the sub with this first line and copy-&-paste code within the sub

    Public Overrides Sub AfterDictionaries(Cancel As ImportOM.API.iCancel)


        Dim strSpouseID As String 'This is what we want to add; Append from RE to the ID column


        'Existing values from Send Appeal Excel File

        Dim strConstID As String '"ID"/"A". This is the primary constituent's unique ID

        Dim strAppeal As String '"Appeal"/"B".This is the appeal ID

        'Dim strPackage as String '"Package"/"C".  This is the package the appeal is attached to.

        Dim dtmDateAdd As Date '"Date"/"D". This is the date of the appeal 

        Dim strNextConstID As String '??


        'Get values (not sure if I should use Excel name or profile name for import data

        'strConstID = Import.Fields.GetByName("ID").Value

        strConstID = Import.Fields.GetByExcelName("A").Value

        'strAppeal = Import.Fields.GetByName("Appeal").Value   

        strAppeal = Import.Fields.GetByExcelName("B").Value 

        'dtmDateAdd = Import.Fields.GetByName("Date").Value

        dtmDateAdd = Import.Fields.GetByExcelName("C").Value


        'Find Spouse IDs

        For each strConstID

            'Check each constituent ID            

            'Check for Spouse Record  

            If oInd.Fields(INDIVIDUAL_fld_IS_SPOUSE) = True Then

                'Check for Spouse Constituent ID (NOT Spouse Relation ID!)

                If object.Spouse.Fields(INDIVIDUAL_fld_CONSTITUENT_ID) "" Then

                    'Set to SpouseID

                    object.Spouse.Fields(INDIVIDUAL_fld_CONSTITUENT_ID) = strSpouseID

                    'Find last row & Append SpouseID to ID field                  


                Else If object.Spouse.Fields(INDIVIDUAL_fld_CONSTITUENT_ID) = "" Then


                End If

            End If

        Next strConstID


    End Sub




End Class


You have to load the constituent record of the spouse to ever create an appeals record on it. You'll have to create an appeals record, add it to the constituent's (spouse) record, then save the spouse record, then close it down.

Psuedo-code below (loading spouse record and closing it down):

Dim spouse As New CRecordClass


spouse.Load(oRec.Fields(Blackbaud.PIA.RE7.BBREAPI.ERECORDSFields.RECORDS_fld_SPOUSE_ID), false)

... add appeals record if fits the criteria ...





You'll obviously need to have the typical conditionals present so not to assume things exist (e.g. check that a spouse id even exists)

An important thing to note when building IOM customizations that actually interact with RE (as opposed to just manipulating the incoming data) is that you need to learn the RE API and how all of that works.  VB is just the vehicle, the RE API is quite unique.

The Blackbaud Knowledgebase actually has quite a few code samples if you look enough and every RE install comes with some API documentation to get you started (C:\Program Files (x86)\Blackbaud\The Raisers Edge 7\Help\RESolutions.chm)

Login or Signup to post a comment