Table: salesforce_user - Query Salesforce Users using SQL
Salesforce Users are the individuals who have log in access to the Salesforce organization. They are associated with a unique username and profile that determines the level of access they have within the organization. User information includes details about the user's name, email, profile, role, and status among other attributes.
Table Usage Guide
The salesforce_user
table provides insights into individual users within Salesforce. As a Salesforce administrator or auditor, explore user-specific details through this table, including their profile, role, and status. Utilize it to uncover information about users, such as their level of access, the roles they are assigned, and their activity status.
Important Notes
- If the
naming_convention
configuration argument is set toapi_native
, please see API Native Examples. - If the naming_convention parameter is set to api_native in the config file, then the table and column names will match what’s in Salesforce. For instance, the query
select username, alias from salesforce_user
would becomeselect "Username", "Alias" from "User"
.
Examples
Basic info
Discover the segments of users in your Salesforce platform, gaining insights into their activity status and last login date. This can be beneficial for assessing user engagement and identifying inactive users.
select username, alias, user_type, is_active, last_login_datefrom salesforce_user;
select username, alias, user_type, is_active, last_login_datefrom salesforce_user;
List active users
Explore which users are currently active in your Salesforce environment. This is useful for understanding user engagement and identifying any potential inactive accounts.
select username, alias, user_type, is_active, last_login_datefrom salesforce_userwhere is_active;
select username, alias, user_type, is_active, last_login_datefrom salesforce_userwhere is_active;
List standard users
Explore which standard users are active within your Salesforce platform. This query is particularly useful in understanding user activity and identifying any inactive accounts that may need attention.
select username, alias, user_type, is_active, last_login_datefrom salesforce_userwhere user_type = 'Standard';
select username, alias, user_type, is_active, last_login_datefrom salesforce_userwhere user_type = 'Standard';
List user designated as forecast managers
Gain insights into your Salesforce users who have been enabled to manage forecasts. This allows you to better understand who in your team has the authority to manipulate and oversee forecasting data.
select id, username, user_type, forecast_enabledfrom salesforce_userwhere forecast_enabled;
select id, username, user_type, forecast_enabledfrom salesforce_userwhere forecast_enabled = 1;
API Native Examples
If the naming_convention
config argument is set to api_native
, the table and column names will match Salesforce naming conventions.
Basic info (with API Native naming convention)
Explore which users are active and when they last logged in to effectively manage user access and understand usage patterns. This is useful for maintaining security, optimizing user experience, and making data-driven decisions.
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User";
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User";
List active users (with API Native naming convention)
Explore which users are currently active and when they last logged in, helping to monitor user activity and understand usage patterns.
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "IsActive";
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "IsActive" = 1;
List guest users
Explore which users in your system are classified as 'Guests'. This is useful for identifying potential security risks or for auditing user access privileges.
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "UserType" = 'Guest';
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "UserType" = 'Guest';
List users who logged-in in last 30 days
Discover the segments of users who have been active within the past month. This is useful for understanding user engagement and activity patterns over time.
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "LastLoginDate" <= now() - interval '30' day;
select "Username", "Alias", "UserType", "IsActive", "LastLoginDate"from "User"where "LastLoginDate" <= datetime('now', '-30 day');
Schema for salesforce_user
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
account_id | text | ID of the Account associated with a Customer Portal user. This field is null for Salesforce users. | |
alias | text | The user's alias. For example, jsmith. | |
created_by_id | text | Id of the user who created the user including creation date and time. | |
department | text | The company department associated with the user. | |
text | The user's email address. | ||
employee_number | text | The user's employee number. | |
forecast_enabled | boolean | Indicates whether the user is enabled as a forecast manager (true) or not (false). | |
id | text | Unique identifier of the user in Salesforce. | |
is_active | boolean | Indicates whether the user has access to log in (true) or not (false). | |
last_login_date | timestamp with time zone | The date and time when the user last successfully logged in. This value is updated if 60 seconds elapses since the user's last login. | |
last_modified_by_id | text | Id of the user who last changed the user fields, including modification date and time. | |
name | text | Display name of the user. | |
profile_id | text | ID of the user's Profile. | |
state | text | The state associated with the User. | |
user_type | text | The category of user license. Can be one of Standard, PowerPartner, CSPLitePortal, CustomerSuccess, PowerCustomerSuccess, CsnOnly, and Guest. | |
username | text | Login name of the user. |
Export
This table is available as a standalone Exporter CLI. Steampipe exporters are stand-alone binaries that allow you to extract data using Steampipe plugins without a database.
You can download the tarball for your platform from the Releases page, but it is simplest to install them with the steampipe_export_installer.sh
script:
/bin/sh -c "$(curl -fsSL https://steampipe.io/install/export.sh)" -- salesforce
You can pass the configuration to the command with the --config
argument:
steampipe_export_salesforce --config '<your_config>' salesforce_user