Skip to main content

Profile

The Profile module provides access to the authenticated member's personal data. You can retrieve the current profile and update editable fields.


Data Model

MemberProfile

FieldTypeDescription
uniqueIdString?Server-assigned unique identifier. Read-only.
memberIdString?Member ID within the organization. Read-only.
firstNameString?Given name.
middleNameString?Middle name.
lastNameString?Family name.
emailString?Email address.
genderString?"M" or "F".
dobString?Date of birth in ISO-8601 format (YYYY-MM-DD).
dayPhoneString?Daytime or landline phone number.
cellPhoneString?Mobile phone number.
addressMemberAddress?Structured mailing address.

MemberAddress

FieldTypeDescription
line1String?Primary street address.
line2String?Apartment, suite, or unit number.
cityString?City or town.
stateString?Two-letter state code (e.g., CA).
zipCodeString?Postal or ZIP code.

Get Profile

Retrieve the authenticated member's profile.

lifecycleScope.launch {
try {
val profile = AFCore.profile().get()
// Populate the UI with the member's data
nameField.text = "${profile.firstName} ${profile.lastName}"
emailField.text = profile.email ?: "Not provided"
} catch (e: Exception) {
showError("Could not load profile: ${e.message}")
}
}

Update Profile

Send a MemberProfile object with the fields you want to change. Only non-nil fields are updated server-side; omitted fields remain unchanged.

lifecycleScope.launch {
try {
val updates = MemberProfile(
firstName = "Alex",
cellPhone = "+1-555-0199",
address = MemberAddress(
line1 = "456 Oak Avenue",
city = "San Diego",
state = "CA",
zipCode = "92101"
)
)
val updated = AFCore.profile().update(profileData = updates)
showSuccess("Profile updated")
} catch (e: Exception) {
showError("Update failed: ${e.message}")
}
}

Best Practices

  • Cache the profile locally to avoid redundant API calls. Refresh when the user navigates to the profile screen or pulls to refresh.
  • Validate inputs before submitting. Validate email format, phone number format, and ZIP code length on the client side to provide immediate feedback.
  • Handle read-only fields. uniqueId and memberId cannot be changed via update(). They are set by the server during account creation.

Quick Reference

// Android
AFCore.profile().get()
AFCore.profile().update(profileData)