turbot/salesforce
steampipe plugin install salesforce

Table: salesforce_order - Query Salesforce Orders using SQL

Salesforce Orders is a feature within Salesforce that allows businesses to manage and track customer orders. It provides a comprehensive view of all orders, including their details, status, and associated accounts. Salesforce Orders helps businesses streamline their order management process, ensuring efficient and effective customer service.

Table Usage Guide

The salesforce_order table provides insights into Order data within Salesforce. As a Sales or Customer Service representative, explore order-specific details through this table, including order number, status, account details, and associated metadata. Utilize it to uncover information about orders, such as those pending, completed, or associated with specific accounts, aiding in efficient order management and customer service.

Important Notes

  • If the naming_convention configuration argument is set to api_native, please see API Native Examples.

Examples

Basic info

Explore the sales orders in Salesforce to analyze their status and total amount. This can be useful for assessing the overall sales performance and identifying any unusual order patterns.

select
id,
name,
account_id,
order_number,
status,
total_amount,
type
from
salesforce_order;
select
id,
name,
account_id,
order_number,
status,
total_amount,
type
from
salesforce_order;

List number of orders by status

Determine the distribution of order statuses to gain insights into business performance. This can help identify areas that require attention, such as unfulfilled orders or returns.

select
count(*),
status
from
salesforce_order
group by
status;
select
count(*),
status
from
salesforce_order
group by
status;

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 orders have a specific status or type to gain insights into overall sales performance and identify potential areas for improvement.

select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order";
select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order";

List number of orders by status (with API Native naming convention)

Analyze the distribution of order statuses to better understand your business operations and customer behavior patterns.

select
count(*),
"Status"
from
"Order"
group by
"Status";
select
count(*),
"Status"
from
"Order"
group by
"Status";

List draft orders

Explore which orders are still in the draft stage to understand their status and manage them effectively. This is useful for tracking uncompleted transactions and identifying potential areas for follow-up or cancellation.

select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order"
where
"Status" = 'Draft';
select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order"
where
"Status" = 'Draft';

List deleted orders

Explore which orders have been deleted to maintain accurate records and ensure proper account management. This aids in tracking potential errors or fraudulent activities.

select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order"
where
"IsDeleted";
select
"ID",
"Name",
"AccountID",
"OrderNumber",
"Status",
"TotalAmount",
"Type"
from
"Order"
where
"IsDeleted";

Schema for salesforce_order

NameTypeOperatorsDescription
_ctxjsonbSteampipe context in JSON form, e.g. connection_name.
account_idtextID of the Account associated with this order.
activated_by_idtextID of the User who activated this order.
activated_datetimestamp with time zoneDate and time when the order was activated.
bill_to_contact_idtextID of the contact that the order is billed to.
billing_addressjsonbThe billing adress for the order.
company_authorized_by_idtextID of the user who authorized the account associated with the order.
company_authorized_datetimestamp with time zoneThe date on which your organization authorized the order.
contract_idtextID of the contract associated with this order. Can only be updated when the order's StatusCode value is Draft.
created_by_idtextId of the user who created the order record.
created_datetimestamp with time zoneCreation date and time of the order record.
customer_authorized_by_idtextID of the contact who authorized the order.
customer_authorized_datetimestamp with time zoneDate on which the contact authorized the order.
descriptiontextDescription of the order.
effective_datetimestamp with time zoneDate at which the order becomes effective.
end_datetimestamp with time zoneDate at which the order ends.
idtextUnique identifier of the order in Salesforce.
is_deletedbooleanIndicates that the order is deleted.
is_reduction_orderbooleanDetermines whether an order is a reduction order.
last_modified_by_idtextId of the user who most recently changed the order record.
last_modified_datetimestamp with time zoneDate of most recent change in the order record.
last_referenced_datetimestamp with time zoneThe timestamp when the current user last accessed this record, a record related to this record, or a list view.
last_viewed_datetimestamp with time zoneThe timestamp when the current user last viewed this record or list view. If this value is null, the user might have only accessed this record or list view (LastReferencedDate) but not viewed it.
nametextTitle for the order that distinguishes it from other orders.
order_numbertextOrder number assigned to this order.
order_reference_numbertextReference number assigned to the order.
original_order_idtextOptional. ID of the original order that a reduction order is reducing, if the reduction order is reducing a single order.
owner_idtext ID of the User or queue that owns this order.
po_datetimestamp with time zoneDate of the purchase order.
po_numbertextNumber identifying the purchase order.
pricebook_2_idtextID of the price book associated with this order.
ship_to_contact_idtextID of the contact that the order is shipped to.
shipping_addressjsonbThe shipping adress for the order.
statustextThe Status field specifies the current state of an order. Status strings represent its current state (Draft or Activated).
status_codetextStatus code of the stage that the order has reached in the order business process.
system_modstamptimestamp with time zoneThe date and time when order record was last modified by a user or by an automated process.
total_amountdouble precisionTotal amount of the order.
typetextType of order.

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_order