This feature adds Salesforce-compatible Contact ID support to the alumni_lookup application, enabling seamless CRM integration while maintaining BUID as the primary identifier.
Added: August 14, 2025 Purpose: Support CRM integration with Salesforce-style Contact IDs (format: C-000000000)
The Contact ID system:
contact_id field to alumni recordscontact_id (string) with unique constraintC-\d{9} (e.g., “C-000198612”)/settings/alumni/upload_alumni processes Contact IDCsv::AlumniExporter)| Search Results: Shows “BUID | Contact ID” format in all alumni listings |
class Alumni < ApplicationRecord
validates :contact_id, format: { with: /\AC-\d{9}\z/, message: "must be in format C-000000000" }, allow_blank: true
validates :contact_id, uniqueness: true, allow_blank: true
end
The import system automatically maps these field names to contact_id:
All CSV exports use the standardized header: AdvRM - Contact ID
BUID,AdvRM - Contact ID,First Name,Last Name
B00558855,C-000198612,Annie,Stewart
B00520725,C-000181963,Erin,Lawrence
buid,AdvRM - Contact ID,pref_name,last_name,...
B00558855,C-000198612,Annie,Stewart,...
B00520725,C-000181963,Erin,Lawrence,...
db/migrate/20250814145917_add_contact_id_to_alumni.rb - Migrationapp/models/alumni.rb - Validationapp/services/csv/alumni_importer.rb - Field normalization and importapp/services/csv/alumni_exporter.rb - Export header and dataapp/controllers/alumni_controller.rb - Permit contact_id parameterapp/controllers/batch_search_controller.rb - Export headerapp/controllers/engagement_stats_controller.rb - Export headerapp/controllers/api/alumni_controller.rb - JSON responseapp/views/alumni/show.html.erb - Display and edit formapp/views/alumni/search.html.erb - Search resultsapp/views/alumni/top_engaged.html.erb - Top engaged displayapp/views/engagement_activities/index.html.erb - Activity listingsapp/views/engagement_stats/_alumni_table.html.erb - Stats tableapp/views/batch_search/create.turbo_stream.erb - Batch search resultsâś… Database migration successful
âś… Model validation works correctly
✅ Import processes “AdvRM - Contact ID” field
âś… Import updates Contact IDs for existing alumni
✅ Export includes “AdvRM - Contact ID” header
âś… UI displays Contact ID appropriately
âś… API includes Contact ID in responses
Issue: The CSV importer was validating Contact IDs but not actually updating them for existing alumni records. The process_existing_alumni method was missing Contact ID update logic.
Fix: Added Contact ID update logic to process_existing_alumni method in app/services/csv/alumni_importer.rb:
# Handle contact_id
new_contact_id = normalized_row['contact_id']&.strip
if should_update_field?(alumni.contact_id, new_contact_id, 'contact_id', alumni, original_data)
alumni.contact_id = new_contact_id
updated = true
puts " Updated contact_id: #{new_contact_id}" if @total_processed % 100 == 0
end
Verification: Import now properly updates existing alumni Contact IDs when CSV contains “AdvRM - Contact ID” data.
This implementation provides: