Skip to main content
The ExperienceCloudToolkit class provides global methods for managing Box App Users within Salesforce Experience Cloud environments. These methods support creating, deactivating, and looking up Box App Users linked to Salesforce users.

Methods

createAppUserforCurrentUser()

Creates a Box App User for the currently logged-in Salesforce user. Signature: Global static BoxUser.Info createAppUserforCurrentUser() Returns:
  • BoxUser.Info. Information about the created or existing Box App User.
Description: This is a convenience method that calls createAppUserforUser() using the current user’s ID. If an active App User already exists for the user, it returns the existing user’s information. Example:

createAppUserforUser(String userId)

Creates or reactivates a Box App User for a specific Salesforce user. Signature: Global static BoxUser.Info createAppUserforUser(String userId) Parameters: Returns:
  • BoxUser.Info. Information about the created or existing Box App User.
Description: This method links a platform-only Box App User to the specified Salesforce user ID. The logic is as follows:
  1. It searches for an existing Box App User where the external_app_user_id matches the Salesforce userId.
  2. If an active user is found, it returns that user’s information.
  3. If an inactive user is found, it reactivates the user and returns its information.
  4. If no user is found, it creates a new App User with the following properties:
    • name: The Salesforce user’s name
    • external_app_user_id: The Salesforce userId
    • is_platform_access_only: true
    • status: active
Example:

deactivateCurrentUserAccount()

Deactivates the Box App User account for the current Salesforce user. Signature: Global static Boolean deactivateCurrentUserAccount() Returns:
  • Boolean. Is true if deactivation was successful, false otherwise.
Description: This is a convenience method that calls deactivateUserAccount() using the current user’s ID to set their Box App User status to inactive. Example:

deactivateUserAccount(String boxUserId)

Deactivates a specific Box App User account. Signature: Global static Boolean deactivateUserAccount(String boxUserId) Parameters: Returns:
  • Boolean. Is true if the deactivation is successful (HTTP 200 OK), and false otherwise.
Description: This method sends a request to the Box API to update a user’s status to inactive. This prevents the user from accessing Box content but does not delete their account. Example:

searchForExistingUser(String externalAppUserId)

Searches for a Box App User by their external ID. Signature: Global static BoxUser.Info searchForExistingUser(String externalAppUserId) Parameters: Returns:
  • BoxUser.Info. Information about the found Box App User.
Throws:
  • ExperienceCloudToolkitException if no user is found with the specified external ID.
Description: Queries the Box API to find an App User whose external_app_user_id matches the provided value. This is useful for checking if a Salesforce user already has an associated Box App User. Example:

Exceptions

ExperienceCloudToolkitException

A custom exception thrown for failed operations, such as when a user is not found by searchForExistingUser().

Notes

  • All methods authenticate with the Box API using the Service Account token.
  • Created App Users are “platform-only” (is_platform_access_only = true), meaning they can only access Box through the application.
  • The external_app_user_id field links Box App Users to Salesforce User IDs.
  • API versioning is managed through the SettingUtils.getAPISetting('ExperienceCloudToolkit') configuration.
Last modified on October 5, 2026