turbot/salesforce
steampipe plugin install salesforce

Table: salesforce_pricebook - Query Salesforce Pricebooks using SQL

A Salesforce Pricebook is a list of products and their prices available in Salesforce. It is a key component of Salesforce's product and price management, allowing businesses to manage different prices for the same product. Pricebooks can be specific to an organization, a business unit, or even a specific customer, providing flexibility in pricing strategies.

Table Usage Guide

The salesforce_pricebook table provides insights into Pricebooks within Salesforce. As a sales manager or a business analyst, explore pricebook-specific details through this table, including related products, standard prices, and associated metadata. Utilize it to uncover information about pricing strategies, such as those specific to different business units or customers, and the verification of pricing policies.

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 name, is_active from salesforce_pricebook would become select "Name", "IsActive" from "Pricebook2".

Examples

Basic info

Analyze the settings to understand the status and creation details of price books in Salesforce. This is useful in assessing the active price books and their creators, which can help in sales strategy planning and management.

select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook;
select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook;

List standard price books

Explore the active standard price books in your Salesforce account. This can help you understand which price books have been created and are currently in use, offering insights into your pricing strategies and structures.

select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook
where
is_standard;
select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook
where
is_standard;

List active price books

Determine the active price books in your Salesforce data. This can help you understand which pricing structures are currently in use, aiding in revenue management and strategic planning.

select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook
where
is_active;
select
name,
is_active,
is_standard,
created_by_id,
created_date,
description
from
salesforce_pricebook
where
is_active;

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 the active and standard status of different price books in your database, along with their creation details and descriptions. This can help understand the variety and usage of different price books in your system.

select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2";
select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2";

List standard price books (with API Native naming convention)

Explore which standard price books are currently active and when they were created to understand their usage and relevance. Similarly, review the archived price books to determine which ones are no longer in use and when they were archived, providing insights into the company's pricing history and potential strategies.

select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsStandard";
select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsStandard" = 1;

Show archived price books

select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsArchived";
select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsArchived";

Show deleted price books

Discover the segments that have been marked as deleted in your pricing system. This information can be used to track changes, assess the impact of deletions, and potentially recover lost data.

select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsDeleted";
select
"Name",
"IsActive",
"IsStandard",
"CreatedById",
"CreatedDate",
"Description"
from
"Pricebook2"
where
"IsDeleted";

Schema for salesforce_pricebook

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form.
created_by_idtextThe id of the user who created the price book.
created_datetimestamp with time zoneDate and time of the creation of the price book record.
descriptiontextDescription of the price book.
idtextUnique identifier of the product in pricebook.
is_activebooleanIndicates whether the price book is active (true) or not (false).
is_archivedbooleanDescribes whether the price book is archived. The default value is false.
is_deletedbooleanIndicates whether the price book has been archived (true) or not (false).
is_standardbooleanIndicates whether the price book is the standard price book for the org (true) or not (false). Every org has one standard price book—all other price books are custom price books.
last_modified_by_idtextId of the user who most recently changed the product record.
last_modified_datetimestamp with time zoneDate of most recent change in the product record.
last_referenced_datetimestamp with time zoneThe timestamp for when the current user last viewed a record related to this record.
last_viewed_datetimestamp with time zoneThe timestamp for when the current user last viewed this record. If this value is null, it's possible that this record was referenced (LastReferencedDate) and not viewed.
nametextThe Price Book Name.
sp_connection_nametextSteampipe connection name.
sp_ctxjsonbSteampipe context in JSON form.
system_modstamptextThe date and time when order record was last modified by a user or by an automated process.

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_pricebook