Identity

class Identity

An immutable Identity class that represents the identity of a user within the Salesforce Marketing Cloud SDK. This class encapsulates user identification information including profile ID, party identification details, and custom attributes.

Getting an Identity Instance

The only way to get an instance of this class is to call SFMCSdk.requestSdk { sdk -> sdk.identity }.

Updating Identity

There are two ways to update the identity:

  • edit function for Kotlin DSL syntax (recommended for Kotlin)

  • Builder pattern for Java and Kotlin

Properties

  • profileId: The unique identifier for the user profile (used by Marketing Cloud Engagement)

  • partyIdentificationName: The user's display name or full name (used by Mobile App Messaging)

  • partyIdentificationNumber: A unique identifier number for the user (used by Mobile App Messaging)

  • partyIdentificationType: The user's category or classification (used by Mobile App Messaging)

  • attributes: A map of custom attributes associated with the identity (shared by both services)

See also

for creating modified instances

for the Kotlin DSL editing interface

Types

Link copied to clipboard
class Builder

Builder class for the Identity class that allows the identity to be modified. This builder provides a fluent API for setting identity properties and building a new Identity instance.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun edit(editor: IdentityEditor.() -> Unit): Boolean

Kotlin-only DSL editing syntax for Identity properties through an IdentityEditor. This function provides a convenient way to modify identity properties using Kotlin's DSL syntax.

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Creates a new Builder instance with the current identity values, allowing them to be modified. This is the primary way to create a mutable copy of the current identity for updates.

Link copied to clipboard

Converts the Identity to a JSONObject representation. This method serializes all identity properties including platform, profile ID, installation ID, party identification details, and attributes into a JSON format.

Link copied to clipboard
open override fun toString(): String