Understanding the Limitation
Screen Flows, built in Salesforce Flow, are not records stored in database tables. Instead, they are definitions, UI-driven runtime interactions, and temporary variable states during execution. None of this data is stored as queryable rows in standard objects, which is why SOQL can’t access it.
The root cause of this issue is the architectural difference between data objects and metadata/runtime processes in Salesforce. SOQL is designed to query data stored in objects, not metadata or execution state.
Workarounds
There are a few workarounds to make Screen Flow data queryable. One approach is to store user inputs in a custom object. You can do this by mapping each screen input to a field on the custom object and using a Create Record or Update Record element to save the data.
Example SOQL Query
SELECT Id, Name, Question_1__c, Question_2__c FROM Flow_Response__c
Another approach is to use non-SOQL APIs, such as the Metadata API or Tooling API, to access flow definitions and metadata.
Best Practices
To make the most of Screen Flows and SOQL, it’s essential to understand the limitations and workarounds. Here are some best practices to keep in mind:
Checklist for Working with Screen Flows and SOQL
- Store user inputs in a custom object to make them queryable.
- Use non-SOQL APIs to access flow definitions and metadata.
- Understand the architectural difference between data objects and metadata/runtime processes in Salesforce.
- Use Create Record or Update Record elements to save data to a custom object.
- Use SOQL to query records created or updated by the Screen Flow.
Frequently Asked Questions
What is the main limitation of using SOQL with Screen Flows?
The main limitation is that SOQL can only query persisted data in objects, while Screen Flows operate mostly in temporary runtime memory and metadata.
Can I use non-SOQL APIs to access flow definitions and metadata?
Yes, you can use the Metadata API or Tooling API to access flow definitions and metadata.
How can I make Screen Flow data queryable?
You can make Screen Flow data queryable by storing user inputs in a custom object or using non-SOQL APIs.
What is the difference between data objects and metadata/runtime processes in Salesforce?
Data objects are records stored in database tables, while metadata/runtime processes are definitions, UI-driven runtime interactions, and temporary variable states during execution.
Can I use SOQL to query records created or updated by the Screen Flow?
Yes, you can use SOQL to query records created or updated by the Screen Flow.
Need help shipping this in production?
Genetrix builds and untangles Salesforce Marketing Cloud and Agentforce setups for teams that want it done right the first time. If anything in this post sounds familiar, talk to us before it ships.