Gradient Works Docs
ProductDynamic BooksPricingRequest Demo
  • Welcome
  • ACCOUNT RESEARCH
    • Overview
      • Features
    • Market Map
      • Account Import
        • Salesforce
        • HubSpot
      • Salesforce Integration
        • How to Install Similar Accounts Component
      • CRM Export
        • Salesforce
        • HubSpot
      • FAQs
        • Attributes in Market Map
    • AI Researcher
      • How to create & configure an AI Researcher
      • Writing effective prompts
      • Prompt examples
      • Managed AI Researcher
    • Lookalikes
    • Credits
  • Bookbuilder
    • Overview
    • Enroll Accounts
    • Target Books
      • Target Book Report
      • Edit Reps
    • Account Coverage
      • Market Coverage
      • Rep Coverage
      • Working Activities
    • Transfer Accounts
      • Concepts
      • Account Pool
      • Distributions
      • Retrievals
      • Returns
      • Templates
      • Scheduling
      • Troubleshooting
    • How-to Guides
      • How to Rank Accounts for Distributions and Retrievals
      • How to Use the "Is In" Operator
  • Routing
    • Overview
    • Dashboard
    • Round Robin Queues
      • Create Queues
      • User Availability Status
      • User Working Hours
    • Users
    • Capacity Meters
    • Lead and Account Matching
    • Automation
      • Automation Executions
      • Log Entries
  • Automation Builder Kit (ABK)
    • Getting Started
    • Actions
      • Assignment
        • Directly Assign Items
        • Round Robin Assign Single Item
        • Round Robin Assign Multiple Items
        • Schedule and Assign Single Item
      • Dynamic Books
        • Retrieval
      • Flow Lifecycle
        • Execute Subflow
        • Failed
        • Finish
        • Resume
        • Start
      • Leads
        • Convert Lead
        • Convert Multiple Leads
      • Logs
        • Log Message
      • Matching
        • Match Account to Account
        • Match Lead to Account
        • Match Lead to Contact
        • Match Lead to Lead
      • Next Steps
        • Add Person to Campaign
        • Add Person to Sales Engagement Cadence
        • Check Person Enrollment in Cadence
        • Create Task
        • Send Single Assignment Email
        • Send Slack Message
      • Users
        • Get Used Capacity
        • Update Capacity
        • Update Weight
      • Utils
        • Evaluate Domain against Denylist
      • Advanced
        • Build Record Map from Lookup
        • Build Record Map from Field
        • Build Text Collection from Field
        • Convert ItemAssigned to Assignment
        • Execute SOQL
        • Get Record from Record Map
        • Assign Pending Items for Multiple Queues
        • Assign Pending Items for Single Queue
        • Enqueue Multiple Items
        • Enqueue Single Item
    • Models
      • AccountMatchResult
      • AccountToAccountMatch
      • Assignment
      • ConvertLeadRequest
      • ConvertLeadResult
      • DomainEvaluationResult
      • GenericSObject
      • LeadToAccountMatch
      • LeadToContactMatch
      • LeadToLeadMatch
      • QueueUserWeight
      • RecordMap
  • Integrations
    • Getting Started
    • Slack
    • Google Workspace
    • Microsoft 365
    • Salesloft
    • Outreach
  • Advanced
    • Salesforce Permissions
  • Miscellaneous
    • Changelog
Powered by GitBook
On this page
  • Inputs
  • Outputs
  1. Automation Builder Kit (ABK)
  2. Actions
  3. Advanced

Execute SOQL

Execute a custom SOQL query and use the results in Flow

PreviousConvert ItemAssigned to AssignmentNextGet Record from Record Map

Last updated 2 years ago

This is an advanced action. If your query is not specific enough, your flow may run slowly or fail. Only use this if you have a thorough understanding of SOQL and the built-in Get Records action is too restrictive to do what you need.

Takes a and executes it within a Flow, retrieving the records according to the specified query. This provides a useful tool for getting around some of the limitations of the built-in Get Records action.

For example, consider the requirement to fetch a list of Users based on whether their Role name contains the word "Sales". Using Get Records will require you to use OR conditions with hard-coded Role Ids. Using this action, you can use SOQL's built-in like so:

SELECT Id, Name, Email FROM User WHERE UserRole.Name LIKE '%Sales%'

Other use cases for this include IN/NOT IN queries or LIMIT clauses to retrieve only a subset of records.

To use the results, you'll need to store the output in a variable of type Record with the Object Type set to the object you're querying (e.g. User in the example above). Be sure to specify that the variable is a Collection.

When you use records retrieved by this action, only the fields you specify will be available.

Inputs

Name
Required
Type
Description

query

Yes

String

The SOQL query to be executed

Outputs

Name
Type
Description

records

List<SObject>

The collection of records retrieved by the SOQL query. The object type of these records is determined by the FROM clause in the SOQL query itself.

SOQL query
relationship queries