Start a new topic

Adding address attribute via API

When importing addresses I have written code so that, before a constituent save, each of the constituent's addresses are checked for certain criteria. If it meets this criteria I want to add a NEW attribute to that address.

I assume I can use .Attributes.Add but I am unsure how. Am I able to create a new attribute, define it's category, description and date, then add it to an address?



Something like:

With oAddress.Attributes.Add()
.Fields(EattributeFields.Attribute_fld_ATTRIBUTETYPES_ID) = [Attribute Category]
.Fields(EattributeFields.Attribute_fld_VALUE) = [Attribute Description]
.Fields(EattributeFields.Attribute_fld_ATTRIBUTEDATE) = [Attribute Date]
End With

This assumes you have the following line at the top of your code:
Imports Blackbaud.PIA.RE7.BBREAPI

If you need to find the attribute type id then you will have to load up an AttributeTypesServer
Thanks, that worked perfectly.

Rather than matching the category to the AttributeTypesServer I was lazy. To find out the attribute type ID I added the attribute I wanted, to a test record, with a comment and iterated through the attributes returning the ID and comment.

This helps too if you have access to the RE Database

For table values
WHERE LongDescription LIKE '%'+@EntryYouWant+'%' 

For Attributes
FROM dbo.AttributeTypes 
WHERE DESCRIPTION LIKE '%'+@AttributeYouWant+'%'

Login or Signup to post a comment