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:

  1. Kotlin DSL syntax (recommended for Kotlin) - using the edit function
  2. Builder pattern - for Java and Kotlin compatibility
PropertyTypeDescription
profileIdString?Unique identifier for user profile (Marketing Cloud Engagement)
partyIdentificationNameString?User’s display name or full name (Mobile App Messaging)
partyIdentificationNumberString?Unique identifier number for user (Mobile App Messaging)
partyIdentificationTypeString?User’s category or classification (Mobile App Messaging)
attributesMap<String, String?>Custom attributes map (shared by both services)
registrationIdStringRegistration 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.