Error: Run-time error '-21472198666 (80040666): A duplicate phone number and phone type exists. Remove the duplicate to save the record

This issue has been reported when updating a Raiser's Edge record directly, through Raiser's Edge integrations that include contact information updates (ex. RELO) and when using the API in RE 7.95 patch #1 thru patch #3 to add a phone number to a constituent record variations of the following error message are displayed:

Run-time error '-21472198666 (80040666):
A duplicate phone number and phone type exists. Remove the duplicate to save the record.
We have evaluated this issue and determined the error is valid when saving the same phone number and phone type to Raiser's Edge. For Raiser's Edge integrations or customization questions regarding this error please contact Support.

We recommend adding any program suggestions to our
Ideas Community page. Our developers check here first when building program enhancements to see what our users are most interested in seeing implemented.

Steps to Duplicate

  1. Use the new CConstitPhone and CConstitPhones object to create an API application to add a phone number.
  2. Execute the application and note that the first run is successful but the second execution will fail with the error message.
The following sample code is used in the AddPhoneTest2.exe application to add a number to the Robert Hernandez record in RE sample data.

Public Sub TestSavingDuplicatePhones()
   
        Dim constit As New CRecord
        constit.Init SessionContext
         
        constit.LoadByField uf_Record_CONSTITUENT_ID, "96"
        
        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) = "Home" Then
                Set phones = parent.phones
                Set phone = phones.Add
                Set dataObj2 = phone
                dataObj2.Fields(ECONSTITPHONEFIELDS.CONSTIT_PHONES_fld_NUM) = "7185551234"
                dataObj2.Fields(ECONSTITPHONEFIELDS.CONSTIT_PHONES_fld_PHONETYPE) = "Home"
                              
                Exit For
            End If
        Next
        
        constit.Save
        constit.Closedown
        Set constit = Nothing
   
   End Sub

Environment

 Raiser's Edge
 7.95
 7.95.6283.1

Was this article helpful?