Start a new topic

Overwrite with null

Hi


Iom will not overwrite non null date values (on a relationship) with null values, so need to use the API.


is there a specific api command/value to set a field to null

or do i just set the field value to ""

with something like

Import.Fields.GetByExcelName("D").Value.Set = ""


thanks

Nick


Hi Nicholas,


The problem with that code is that it is just changing the data in the import to null, and as you said IOM will not overwrite non null date values if there is data on the record.  You would have to access the relationship in BeforeIndividualRelationshipSave or BeforeOrganizationRelationshipSave (or manually load the relationship somewhere else) and update the value from there. As an example this would update the individual relationship in group number one during the BeforeIndividualRelationshipSave  Sub:


If Import.Fields.GetByExcelName("D").Value = String.Empty Then
            'Reference the correct relationship by group number if you have multiple relationships
            If GroupNumber = 1 Then
                oInd.Fields(EINDIVIDUAL2Fields.INDIVIDUAL2_fld_DATE_FROM) = ""
            End If
        End If



Thanks,


John

Thanks John, this is a great help. will give it a go tomorrow.


I am using importomatic to sync between dynamics 365 and raisers edge. IOM not being able to import nulls is a disastrous product limitation imo.


I think i am going to need to have if statements (like your example)  for every (potentially nullable) field we are syncing

do you know what reference document i would read to tell me all the field names in a relationship and on a contact (including constit codes) from the apis point of view.


are you able to provide the location for and the code to set a constiuent "date from" to null (this is my next most important use case)


thanks

Nick



I'd look at Blackbaud's API documentation for fields.  While it probably won't list them all it will get you started.  The relationship constituent code would be changed in a similar manner to the code that I listed above.  Again this is for an individual relationship in the BeforeIndividualRelationshipSave sub.


If Import.Fields.GetByExcelName("D").Value = String.Empty Then
            'Reference the correct relationship by group number if you have multiple relationships
            If GroupNumber = 1 Then
                'Loop through the constituent codes until we find the correct one
                For Each cc As CConstituentCode In oIndRecord.ConstituentCodes
                    If cc.Fields(ECONSTITUENT_CODEFields.CONSTITUENT_CODE_fld_CODE) = "x" Then 'x is the constituent code that you want to update.  If it's always the same you could hard code it here, or if it's based on a value in your import you could reference that through Import.Fields.GetByExcelName.....
                        cc.Fields(ECONSTITUENT_CODEFields.CONSTITUENT_CODE_fld_DATE_FROM) = ""
                    End If
                Next
            End If
        End If


Thanks,


John

Login or Signup to post a comment