Identity Class
The Identity class is an immutable representation of a user’s identity within the Salesforce Marketing Cloud SDK. It encapsulates user identification information including profile ID, party identification details, and custom attributes.
To obtain an Identity instance:
Two methods are available for updating identity:
- Kotlin DSL syntax (recommended for Kotlin) - using the
editfunction - Builder pattern - for Java and Kotlin compatibility
| Property | Type | Description |
|---|---|---|
profileId | String? | Unique identifier for user profile (Marketing Cloud Engagement) |
partyIdentificationName | String? | User’s display name or full name (Mobile App Messaging) |
partyIdentificationNumber | String? | Unique identifier number for user (Mobile App Messaging) |
partyIdentificationType | String? | User’s category or classification (Mobile App Messaging) |
attributes | Map<String, String?> | Custom attributes map (shared by both services) |
registrationId | String | Registration identifier |
Provides a fluent API for setting identity properties and creating new Identity instances.
Kotlin DSL syntax for modifying Identity properties through an IdentityEditor.
Parameters:
editor: Lambda function providing DSL editing interface
Returns: Boolean indicating success of the edit operation
Creates a new Builder instance initialized with current identity values, enabling modifications.
Returns: Identity.Builder instance for updating properties
Serializes the Identity to a JSONObject representation, including platform, profile ID, installation ID, party identification details, and attributes.
Returns: JSONObject containing all identity properties
Standard equality comparison implementation.
Standard hash code implementation.
String representation of the identity.