turbot/salesforce
steampipe plugin install salesforce

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 to api_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 become select "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_date
from
salesforce_user;
select
username,
alias,
user_type,
is_active,
last_login_date
from
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_date
from
salesforce_user
where
is_active;
select
username,
alias,
user_type,
is_active,
last_login_date
from
salesforce_user
where
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_date
from
salesforce_user
where
user_type = 'Standard';
select
username,
alias,
user_type,
is_active,
last_login_date
from
salesforce_user
where
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_enabled
from
salesforce_user
where
forecast_enabled;
select
id,
username,
user_type,
forecast_enabled
from
salesforce_user
where
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

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextID of the Account associated with a Customer Portal user. This field is null for Salesforce users.
aliastextThe user's alias. For example, jsmith.
created_by_idtextId of the user who created the user including creation date and time.
departmenttextThe company department associated with the user.
emailtextThe user's email address.
employee_numbertextThe user's employee number.
forecast_enabledbooleanIndicates whether the user is enabled as a forecast manager (true) or not (false).
idtextUnique identifier of the user in Salesforce.
is_activebooleanIndicates whether the user has access to log in (true) or not (false).
last_login_datetimestamp with time zoneThe 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_idtextId of the user who last changed the user fields, including modification date and time.
nametextDisplay name of the user.
profile_idtextID of the user's Profile.
statetextThe state associated with the User.
user_typetextThe category of user license. Can be one of Standard, PowerPartner, CSPLitePortal, CustomerSuccess, PowerCustomerSuccess, CsnOnly, and Guest.
usernametextLogin 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