Skip to main content

Overview

Power Mode gives you full control over file queries by allowing you to write custom SOQL (Salesforce Object Query Language) directly. This is ideal for advanced users who need complex filtering, custom field selection, or queries that go beyond what Simple Mode offers.
Power Mode requires SOQL knowledge. If you’re new to SOQL, start with Query Builder (Simple Mode) or review our SOQL Examples.

Enabling Power Mode

To switch to Power Mode:
  1. Navigate to the Query & Export page
  2. Find the Power Mode toggle in the query editor header
  3. Click the toggle to enable Power Mode
  4. The visual filters will be replaced with a Monaco code editor
Your Simple Mode filters will be converted to SOQL and pre-filled in the editor. You can then modify the query as needed.

The SOQL Editor

Power Mode features a Monaco editor (the same editor used in VS Code) with:

Syntax Highlighting

SQL syntax highlighting for better readability

Line Numbers

Easily reference and debug specific lines

Multi-line Editing

Write complex queries across multiple lines

Keyboard Shortcuts

Execute with ⌘/Ctrl + Enter

Editor Features

  • Dark Mode Support: Automatically matches your system theme
  • Word Wrap: Long queries wrap for better visibility
  • Tab Size: 2 spaces for clean formatting
  • No Minimap: Maximized editing space

Supported SOQL Features

FileFetch supports standard SOQL syntax for querying Salesforce objects:

SELECT Clause

Specify which fields to retrieve:
SELECT Id, Title, ContentDocumentId, FileExtension, ContentSize
FROM ContentVersion
FileFetch requires certain fields for file downloads to work:For ContentVersion (Files):
  • Id - Record identifier
  • ContentDocumentId - Required for download
For Attachment:
  • Id - Record identifier (also used for download)

WHERE Clause

Filter results with conditions:
SELECT Id, Title, ContentDocumentId
FROM ContentVersion
WHERE IsLatest = true
  AND CreatedDate = LAST_N_DAYS:30
  AND FileExtension IN ('pdf', 'docx')
  AND ContentSize > 1048576
Supported Operators:
  • Comparison: =, !=, <, >, <=, >=
  • Logical: AND, OR, NOT
  • Pattern matching: LIKE
  • List: IN, NOT IN
  • Date literals: LAST_N_DAYS:n, THIS_YEAR, LAST_YEAR, etc.

LIMIT Clause

Control the number of results:
SELECT Id, Title, ContentDocumentId
FROM ContentVersion
WHERE IsLatest = true
LIMIT 500
Salesforce API Limits: SOQL queries are limited to 2,000 rows per query. If you need more files, use CSV Import or run multiple queries with different filters.

ORDER BY Clause

Sort results:
SELECT Id, Title, CreatedDate
FROM ContentVersion
WHERE IsLatest = true
ORDER BY CreatedDate DESC
LIMIT 100
Common Sorting:
  • ORDER BY CreatedDate DESC - Newest first
  • ORDER BY CreatedDate ASC - Oldest first
  • ORDER BY Title ASC - Alphabetical by name
  • ORDER BY ContentSize DESC - Largest files first

Object Filtering

Power Mode allows you to query files attached to specific objects using custom criteria.
Note: The object filter dropdown is disabled in Power Mode. If you need to filter by related objects, you must write the query logic manually.
FileFetch uses a two-query approach when filtering by objects:
  1. First query: Fetch record IDs from the target object (e.g., Account)
  2. Second query: Fetch files linked to those records via ContentDocumentLink
Example: To find files on Accounts in California:
-- This is conceptual - FileFetch handles the ContentDocumentLink join internally
-- You just specify the object filter criteria
For advanced object filtering, contact support or see SOQL Examples.

Common Query Patterns

All PDFs Created This Year

SELECT Id, Title, ContentDocumentId, FileExtension, ContentSize, CreatedDate
FROM ContentVersion
WHERE IsLatest = true
  AND FileExtension = 'pdf'
  AND CreatedDate = THIS_YEAR
ORDER BY CreatedDate DESC
LIMIT 500

Large Files (> 10MB)

SELECT Id, Title, ContentDocumentId, ContentSize, FileExtension
FROM ContentVersion
WHERE IsLatest = true
  AND ContentSize > 10485760
ORDER BY ContentSize DESC
LIMIT 200

Files Modified in Last 7 Days

SELECT Id, Title, ContentDocumentId, LastModifiedDate
FROM ContentVersion
WHERE IsLatest = true
  AND LastModifiedDate = LAST_N_DAYS:7
ORDER BY LastModifiedDate DESC

Specific File Types

SELECT Id, Title, ContentDocumentId, FileExtension
FROM ContentVersion
WHERE IsLatest = true
  AND FileExtension IN ('pdf', 'docx', 'xlsx', 'pptx')
LIMIT 1000

Files with Specific Title Pattern

SELECT Id, Title, ContentDocumentId, CreatedDate
FROM ContentVersion
WHERE IsLatest = true
  AND Title LIKE '%Invoice%'
ORDER BY CreatedDate DESC
LIMIT 500

All Versions of Files

SELECT Id, Title, ContentDocumentId, VersionNumber, CreatedDate
FROM ContentVersion
WHERE ContentDocumentId IN (
  SELECT ContentDocumentId
  FROM ContentVersion
  WHERE Title LIKE '%Contract%'
)
ORDER BY ContentDocumentId, VersionNumber

Querying Attachments

For legacy attachments, query the Attachment object:
SELECT Id, Name, ParentId, ContentType, BodyLength, CreatedDate
FROM Attachment
WHERE CreatedDate = LAST_N_DAYS:90
  AND Name LIKE '%.pdf'
ORDER BY CreatedDate DESC
LIMIT 500
Key Differences from ContentVersion:
  • Use Name instead of Title
  • Use BodyLength instead of ContentSize
  • No FileExtension field (use pattern matching on Name)
  • No version support (IsLatest not applicable)
  • ParentId links directly to parent record

Query Validation

FileFetch validates your query before execution:
Query executes successfully and returns results in the table below the editor.
Error: unexpected token: 'SELCT'Cause: Typo or invalid SOQL syntaxSolution: Review the query for typos and ensure proper SOQL syntax
Error: No such column 'InvalidField' on entity 'ContentVersion'Cause: Field doesn’t exist on the objectSolution: Check field API names in Salesforce or see Salesforce Objects Reference
Error: Query must include ContentDocumentId for file downloadsCause: Required field not in SELECT clauseSolution: Add the required field to your SELECT clause
Warning: Query returned 2000 rows (SOQL limit reached)Cause: Query matches more than 2000 recordsSolution: Add more specific WHERE conditions or use LIMIT

Query History

FileFetch automatically saves your query history:
  1. Click the Query History icon in the sidebar
  2. View previously executed queries
  3. Click a query to reload it in the editor
  4. Edit and re-execute as needed
Query history is saved locally and persists between sessions. Use this to quickly re-run common queries or learn from past searches.

Help Text

While editing in Power Mode, you can access contextual help:
  • Click the ? icon or Help link
  • View quick reference for SOQL syntax
  • See examples of common WHERE clauses
  • Access field reference for ContentVersion and Attachment

Switching Back to Simple Mode

To return to visual filters:
  1. Toggle Power Mode off
  2. Your custom query will be reset to the default Simple Mode query
  3. The visual filter dropdowns will reappear
Switching back to Simple Mode discards your custom SOQL query. If you want to keep it, copy it first or save it in Query History.

Best Practices

Start Simple, Add Complexity

Begin with a basic query, then add filters incrementally

Test with LIMIT

Use small LIMIT values while testing, then increase for full export

Use ORDER BY

Sort results for predictable ordering and easier review

Comment Your Queries

Use -- for comments to document complex query logic

Limitations

Power Mode has some restrictions:
FeatureSupportedNotes
SELECT✅ YesMust include required fields for downloads
WHERE✅ YesAll standard SOQL operators
ORDER BY✅ YesSingle or multiple fields
LIMIT✅ YesMax 2000 (Salesforce limit)
OFFSET❌ NoNot supported by FileFetch
GROUP BY❌ NoNot applicable for file exports
HAVING❌ NoNot applicable for file exports
Subqueries⚠️ LimitedOnly in WHERE clause, not FROM
Aggregate Functions❌ NoCOUNT, SUM, etc. not supported
JOIN❌ NoUse ContentDocumentLink filtering instead

Advanced Examples

Files Created by Specific User

SELECT Id, Title, ContentDocumentId, CreatedBy.Name, CreatedDate
FROM ContentVersion
WHERE IsLatest = true
  AND CreatedBy.Name = 'John Smith'
ORDER BY CreatedDate DESC

Files Larger Than Average

-- First, calculate average size manually or use filters
SELECT Id, Title, ContentDocumentId, ContentSize
FROM ContentVersion
WHERE IsLatest = true
  AND ContentSize > 5242880  -- 5MB threshold
ORDER BY ContentSize DESC
LIMIT 100

Files with Multiple Extensions

SELECT Id, Title, ContentDocumentId, FileExtension
FROM ContentVersion
WHERE IsLatest = true
  AND (
    FileExtension LIKE 'doc%'
    OR FileExtension LIKE 'xls%'
    OR FileExtension LIKE 'ppt%'
  )
LIMIT 500

Getting Help