Start a new topic

Treating Constituent Attributes differently based on Description


Newbie to the API so please be nice!  Looking at the potential of moving the Data Protection Preferences from Solicit Codes across to Constituent Attributes so dates and comments can be recorded (will also work nicely with Chimpegration).

Is it possible for an import profile to be setup to not create a duplicate constituent attribute in a case like this:

Constituent Attribute Category: Data Protection Preferences

Description: Email Opt-In   OR    No Mail    OR    No Phone    OR    SMS Opt-In

Let's say my RE record already has the Constituent Attribute Description of Email Opt-In and another of No Mail for this Category.  The file I'm going to import contains the same Category with Description of another Email Opt-In. (Each Description option would have it's own specific column)


If we were to use the standard 'Update existing' function this could overwrite the Constituent Attribute with No Mail into Email Opt-In, thefore losing the preference.  If the 'Add new attribute' function is used this would create duplicates of the same description.

Is it possible to code something in the API to recognise the Constituent Attribute Description and treat it differently for this?

Also if a value is blank in the import file's specific Description column, can the API be called to delete the matching Attribute (e.g. my record has No Phone, but the latest donation form I completed did not opt out of phone calls - so the import field of No Phone will be blank meaning I can be contacted by phone).




1 Comment

This is definitely possibly through the API although it would take some work.

I think the way I would approach it is by starting in AfterConstituentOpen so that you have access to all of the constituent attributes. Then you can loop through the existing attributes and pull out the "Data Protection Preferences" ones. Then loop through the input values and try to match them up. If they match, ignore them, if they exist on the record but not in the input, delete them, and if they exist in the input but not the constituent then add them.

If you are going to have the whole list of codes for each import then you could do it a little more simply and delete all of the attributes each time and just add the imports as new attributes. That way it would just overwrite each time. This wouldn't work if you are appending instead though.

It might actually be easier if the data had a row for each attribute value (repeating cons IDs). That way each pass in the import could just look up a specific attribute value and add/delete it.

The easiest option is to just overwrite everything each time but that's only an option if you have all of the data each time. If not you will have to cycle through the attributes and the input values and match them up to decide what to do.

Login or Signup to post a comment