Tag Archives: VBA

Working with RE7.95 and phone configuration rules

In v7.95 of RE7, there were some new config business rules introduced which prevent duplicate phone or emails being added to a record.

phone config

I have not really found this to be consistent though. When I use this inside of a constituent record it does not seem to make the slightest difference which setting. I can have to “Email” phone types but no matter which setting is selected above it saves fine. This does seem to work better with phones (as opposed to emails). Although even when I have the setting as “Do not allow record to be saved” it still prompts to if I want to save it.

When I run this through code however I do get an error… sometimes.

If I have a matching phone type but different phone number it seems to work fine most of the time (although once I got an error message). If I have a matching phone type and phone number I will always get the error as shown below. This does not seem to be affected by the options above though.

duplicate phone error

I am wondering wondering if there is a way of controlling the error. If this were working as expected then it should be possible to permit the record to be saved if the options is “Display warning”.

Here is my test code:

 Public Sub TestSavingDuplicatePhones()
        Dim constit As New CRecord
        constit.Init SessionContext             

        constit.LoadByField uf_Record_CONSTITUENT_ID, "3"
        Dim parent As IBBPhonesParent
        Set parent = constit        

        Dim phone As CConstitPhone
        Dim phones As CConstitPhones
        Dim dataObj As IBBDataObject
        Dim phone2 As CConstitPhone
        Dim dataObj2 As IBBDataObject
        For Each phone In parent.phones
            Set dataObj = phone
            If dataObj.Fields(ECONSTITPHONEFIELDS.CONSTIT_PHONES_fld_PHONETYPE) = "Email" Then
                Set phones = parent.phones
                Set phone = phones.Add
                Set dataObj2 = phone
                dataObj2.Fields(ECONSTITPHONEFIELDS.CONSTIT_PHONES_fld_NUM) = "1234"
                dataObj2.Fields(ECONSTITPHONEFIELDS.CONSTIT_PHONES_fld_PHONETYPE) = "Email"                             

                Exit For
            End If

        Set constit = Nothing   
   End Sub

Raiser’s Edge Integration with REST webservice

I have been working on a new version of RETweet which will be released soon. In that version we are allowing users to create constituents from Twitter users. The amount of information that you get from Twitter about the Tweet and the person that tweeted is very limited. The real name of the Twitter user – and it is not always a real name – is given in one field so it could include the first and last name (this is the most common where it is not a Tweeting business).  To make this more useful the application reaches out to a webservice to determine the gender of the person.

The webservice takes the first name and returns gender information and which countries the name appears in. The web service is biased towards European and Western first names but does claim to cover some countries in Asia too.

This could also easily be integrated as a VBA solution so that when you save and close a constituent record, if the gender is unknown the VBA code reaches out to the webservice and populates the code. Here is some sample code that shows you how this is done. This is done using .NET as it is considerably easier to achieve than in the native VBA environment. It would, however, be easy to make a call to a COM visible assembly from the native VBA client to call this method.


' Determines the gender of the person by looking up useing Thomas Bayer's webservice.
Private Sub SetGender(firstName As String, constit as CRecord) 

   Dim xdoc As XDocument
      'Here we retrieve the XML document from the REST web service
      xdoc = sendXML("http://www.thomas-bayer.com/restnames/name.groovy?name=" & firstName)

      Dim result = xdoc.<restnames>

      'if there is an error then the gender cannot be found
      If result.Descendants("error").Count > 0 Then
      End If

      'This is not an ideal check as a name can be both male and female
      'but for simplicity we assume this is not the case
      If resultresult.<nameinfo>.<male>.FirstOrDefault.Value.ToLower = "true" Then
         constit.Fields(ERECORDSFields.RECORDS_fld_GENDER) = "male"
         constit.Fields(ERECORDSFields.RECORDS_fld_GENDER) = "female"
      End If
         'If there is an error due to the web service we catch it here and don't bother the end user.
      End Try

End Sub

Private Function sendXML(ByVal uri As String) As XDocument

   Dim request As HttpWebRequest
   Dim response As HttpWebResponse
   Dim reader As XmlReader

   request = HttpWebRequest.Create(uri)
   response = request.GetResponse()

   reader = XmlReader.Create(response.GetResponseStream())
   Return XDocument.Load(reader)

End Function


Look out for our new version of RETweet. It will include this and a lot of other new features!

Customizations, SDKs and API’s, Oh RE

If you recognise the title of this post then I was inspired by a BlackbaudKnowHow article of a similar name. In that article the author describes the differences between the three terms and how they relate to Blackbaud Enterprise CRM. This is a good overview and works well for Blackbaud Enterprise CRM. However it breaks down when talking about The Raiser’s Edge 7.

Continue reading Customizations, SDKs and API’s, Oh RE

Audit Trail on the Infinity platform versus The Raiser’s Edge 7

I was prompted to write this after seeing a tweet highlighting Altru’s history function. The tweet pointed to the Blackbaud Know How article about how you can see who changed what and when on a record. For those of you unfamiliar with Altru, it is one of the more recent applications released on the Infinity platform.

Continue reading Audit Trail on the Infinity platform versus The Raiser’s Edge 7

Subtle changes in Visual Studio 2010 make Raiser’s Edge API less typing

I have been using Visual Studio 2010 for a short while now ever since the prospect of developing workflows for Enterprise CRM became a reality. One thing that I noticed when working with The Raiser’s Edge API however is that it is much faster to type out everything.

Continue reading Subtle changes in Visual Studio 2010 make Raiser’s Edge API less typing

Opening a Crystal Report from code (revisited)

In an earlier post I looked at the way in which it is possible to open up a Crystal Report from VB or VBA code in The Raiser’s Edge. That was with version 8.5 of Crystal Reports. I tried to do the same thing recently with a report created in Crystal Reports 11 and the code broke. I rewrote the code using a newer object and technique.

Continue reading Opening a Crystal Report from code (revisited)

Accessing other parallel VBA DLLs in The Raiser’s Edge

One of the methods for writing VBA code that fires when, say a constituent is saved, is to write a VBA DLL. I have covered this previously so I won’t go into details in this post. However what do you do if you need one VBA DLL to talk to another one? For example if I make a change to a record in one VBA DLL and have installed Zeidman Development’s Audit Trail application (excuse me for the gratuitous plug there) how do I tell the audit trail to make a note of this change? The VBA events are only fired when the Raiser’s Edge GUI opens up or saves a record and not when the code does so.

Continue reading Accessing other parallel VBA DLLs in The Raiser’s Edge

Opening a link from a Constituent

There was a question recently on Blackbus asking how to open a link from a constituent record. For example if you had an external system that uses constituent ids to find individuals it would be very useful to be able to open a web page from the constituent window by pressing the macro button and going to the web page that is specific for the constituent. This requires the VBA module. Here is how it is done:

Continue reading Opening a link from a Constituent

A first look at Blackbaud’s Infinity platform

What better way of starting the new year than taking a look at the next generation of Blackbaud’s products that are based on their Infinity platform. A couple of products have already been released but unlike many other products released into the IT wild Blackbaud has chosen, wisely in my opinion, to make the release a quiet affair and not a must have upgrade. I have managed to take a look at Blackbaud CRM. This product is aimed at the larger fundraising organisation and its flexibility certain shows this.

Continue reading A first look at Blackbaud’s Infinity platform