alumni_lookup

Alumni Contact ID Integration

This feature adds Salesforce-compatible Contact ID support to the alumni_lookup application, enabling seamless CRM integration while maintaining BUID as the primary identifier.

Overview

Added: August 14, 2025 Purpose: Support CRM integration with Salesforce-style Contact IDs (format: C-000000000)

The Contact ID system:

Key Features

đź”§ Database Schema

📥 Import Functionality

📤 Export Functionality

🖥️ User Interface

Implementation Details

Model Validation

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

CSV Field Mapping

The import system automatically maps these field names to contact_id:

Export Headers

All CSV exports use the standardized header: AdvRM - Contact ID

Sample Data Format

Import CSV

BUID,AdvRM - Contact ID,First Name,Last Name
B00558855,C-000198612,Annie,Stewart
B00520725,C-000181963,Erin,Lawrence

Export CSV

buid,AdvRM - Contact ID,pref_name,last_name,...
B00558855,C-000198612,Annie,Stewart,...
B00520725,C-000181963,Erin,Lawrence,...

Files Modified

Database

Import/Export Services

Controllers

Views

Testing Verification

âś… 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

Bug Fixes Applied

Contact ID Import Update Issue (August 14, 2025)

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.

Usage

Importing Contact IDs

  1. Navigate to Settings → Alumni → Upload Alumni
  2. Upload CSV with “AdvRM - Contact ID” column
  3. System automatically maps and validates Contact IDs
  4. View results in alumni records

Exporting with Contact IDs

  1. Use any alumni export function (search, champion signups, etc.)
  2. CSV will include “AdvRM - Contact ID” column
  3. Import directly into Salesforce or other CRM systems

Manual Entry

  1. Open any alumni record
  2. Click “Edit Alumni Data”
  3. Enter Contact ID in “AdvRM - Contact ID” field (format: C-000000000)
  4. Save changes

CRM Integration

This implementation provides: