query.nu
4 exported commands
0 internal commandssf query
Run a SOQL query against Salesforce.
Returns the records as a table by default, with Salesforce attributes metadata removed. Use --include-attributes to keep the attributes fields in each returned record. Use --raw to get the full Salesforce response (includes totalSize, done, etc). Use --all to auto-paginate through all result pages. Use --include-deleted to query deleted/archived records (uses queryAll/ endpoint).
Usage
sf query {flags} <soql>
Flags
-h, --help- Display the help message for this command
--all- Auto-paginate to fetch all records
--raw- Return the raw Salesforce JSON response
--include-attributes- Keep Salesforce attributes metadata in each returned record
--include-deleted- Include deleted/archived records (queryAll endpoint)
Parameters
soql <string>- The SOQL query string
Input/output types
| # | input | output |
|---|---|---|
| 0 | any | any |
Examples
query accounts
sf query "SELECT Id, Name FROM Account LIMIT 10"query all leads with auto-pagination
sf query --all "SELECT Id, Name FROM Lead"keep Salesforce attributes metadata
sf query --include-attributes "SELECT Id, Product2.Name FROM Asset LIMIT 1"get raw query response
sf query --raw "SELECT Id FROM Contact"query deleted records
sf query "SELECT Id FROM Account WHERE IsDeleted = true" --include-deletedsf query-more
Fetch the next page of results from a previous query.
Use this when you get partial results and want manual pagination control. Returned records omit Salesforce attributes metadata by default. Pass the nextRecordsUrl from a --raw query response.
Usage
sf query-more {flags} <next_records_url>
Flags
-h, --help- Display the help message for this command
--raw- Return the raw Salesforce JSON response
--include-attributes- Keep Salesforce attributes metadata in each returned record
Parameters
next_records_url <string>- The nextRecordsUrl from a previous query response
Input/output types
| # | input | output |
|---|---|---|
| 0 | any | any |
Examples
fetch the next page of query results
let page1 = (sf query --raw "SELECT Id FROM Account"); if (not $page1.done) { sf query-more $page1.nextRecordsUrl }sf search
Run a SOSL search against Salesforce.
Pass the full SOSL query string (e.g. "FIND {Waldo}").
Usage
sf search <sosl>
Flags
-h, --help- Display the help message for this command
Parameters
sosl <string>- The SOSL search string
Input/output types
| # | input | output |
|---|---|---|
| 0 | any | any |
Examples
search for accounts matching Acme
sf search "FIND {Acme} IN ALL FIELDS RETURNING Account(Id, Name)"sf quick-search
Run a quick SOSL search — wraps the search term in FIND {...}.
Usage
sf quick-search <term>
Flags
-h, --help- Display the help message for this command
Parameters
term <string>- The search term (will be wrapped in FIND {...})
Input/output types
| # | input | output |
|---|---|---|
| 0 | any | any |
Examples
quick search for Acme
sf quick-search "Acme"