---
schema_version: "1"
id: 7a2b7af6c46764ca8642b2d4fc5dd491755b4229162d08d73cd36f7f3fcb3c58
title: Interface User
collection: developer
version: current
locale: en-us
portal_url: https://docs.salesforce.com/developer/current/en-us/salesforce-functions/functions/guide/javasdk/interfaces/java-user.md
canonical_url: https://developer.salesforce.com/docs/platform/functions/guide/java-user.html
source_site: developer.salesforce.com
content_type: documentation
content_hash: c882e8284e27fd145b5011478c78c9a9d0dc43ca0cf002d369ba03c51e1d92a3
products:
  - Salesforce Functions
---
# Interface User

------------------------------------------------------------------------

public interface User

Holds information about the invoking Salesforce user.

## Method Summary

| Modifier and Type                      | Method                  | Description                                                 |
| -------------------------------------- | ----------------------- | ----------------------------------------------------------- |
| `java.lang.String`                     | `getId()`               | Returns the user's ID.                                      |
| `java.util.Optional<java.lang.String>` | `getOnBehalfOfUserId()` | Returns the id of the user this user operates in behalf of. |
| `java.lang.String`                     | `getUsername()`         | Returns the name of the user.                               |

## Method Details

### getId

\@Nonnull java.lang.String getId()

Returns the user\'s ID.

Returns: The user\'s ID.

### getUsername

\@Nonnull java.lang.String getUsername()

Returns the name of the user.

Returns: The name of the user.

### getOnBehalfOfUserId

\@Nonnull java.util.Optional\<java.lang.String\> getOnBehalfOfUserId()

Returns the id of the user this user operates in behalf of.

Returns: The id of the user this user operates in behalf of.
