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 toapi_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, typefrom salesforce_order;
select id, name, account_id, order_number, status, total_amount, typefrom 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(*), statusfrom salesforce_ordergroup by status;
select count(*), statusfrom salesforce_ordergroup 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
Name | Type | Operators | Description |
---|---|---|---|
_ctx | jsonb | Steampipe context in JSON form, e.g. connection_name. | |
account_id | text | ID of the Account associated with this order. | |
activated_by_id | text | ID of the User who activated this order. | |
activated_date | timestamp with time zone | Date and time when the order was activated. | |
bill_to_contact_id | text | ID of the contact that the order is billed to. | |
billing_address | jsonb | The billing adress for the order. | |
company_authorized_by_id | text | ID of the user who authorized the account associated with the order. | |
company_authorized_date | timestamp with time zone | The date on which your organization authorized the order. | |
contract_id | text | ID of the contract associated with this order. Can only be updated when the order's StatusCode value is Draft. | |
created_by_id | text | Id of the user who created the order record. | |
created_date | timestamp with time zone | Creation date and time of the order record. | |
customer_authorized_by_id | text | ID of the contact who authorized the order. | |
customer_authorized_date | timestamp with time zone | Date on which the contact authorized the order. | |
description | text | Description of the order. | |
effective_date | timestamp with time zone | Date at which the order becomes effective. | |
end_date | timestamp with time zone | Date at which the order ends. | |
id | text | Unique identifier of the order in Salesforce. | |
is_deleted | boolean | Indicates that the order is deleted. | |
is_reduction_order | boolean | Determines whether an order is a reduction order. | |
last_modified_by_id | text | Id of the user who most recently changed the order record. | |
last_modified_date | timestamp with time zone | Date of most recent change in the order record. | |
last_referenced_date | timestamp with time zone | The timestamp when the current user last accessed this record, a record related to this record, or a list view. | |
last_viewed_date | timestamp with time zone | The 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. | |
name | text | Title for the order that distinguishes it from other orders. | |
order_number | text | Order number assigned to this order. | |
order_reference_number | text | Reference number assigned to the order. | |
original_order_id | text | Optional. ID of the original order that a reduction order is reducing, if the reduction order is reducing a single order. | |
owner_id | text | ID of the User or queue that owns this order. | |
po_date | timestamp with time zone | Date of the purchase order. | |
po_number | text | Number identifying the purchase order. | |
pricebook_2_id | text | ID of the price book associated with this order. | |
ship_to_contact_id | text | ID of the contact that the order is shipped to. | |
shipping_address | jsonb | The shipping adress for the order. | |
status | text | The Status field specifies the current state of an order. Status strings represent its current state (Draft or Activated). | |
status_code | text | Status code of the stage that the order has reached in the order business process. | |
system_modstamp | timestamp with time zone | The date and time when order record was last modified by a user or by an automated process. | |
total_amount | double precision | Total amount of the order. | |
type | text | Type 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