Skip to main content

How to Use AI Query Generator + SOQL Querying for Salesforce

ExtendInsights | Use AI-generated SOQL to extract Salesforce data faster

Updated this week

ExtendInsights Analytics now includes an AI-powered SOQL Query Generator for Salesforce, allowing you to download Salesforce data using natural language. This feature eliminates the need to manually write SOQL for most use cases and enables fast, flexible data exploration directly in Excel.

With AI + SOQL, you can convert English prompts into SOQL, preview results instantly, and automate reports with schedules.


Step 1: Enter a Prompt to Generate a SOQL Query

In the Query Builder for Salesforce:

  1. Open the ExtendInsights add-in in Excel.

  2. Select Salesforce and click Ask AI.

  3. A window will open. In the AI prompt box, type a natural-language request.

    Example

    User Input:

    Show all leads with status Working - Contacted for this year

    Generated SOQL:

    SELECT Id, Name, Company, Status, CreatedDate FROM Lead WHERE Status = 'Working - Contacted' AND CreatedDate = THIS_YEAR AND IsDeleted = false

  4. Click Update.

You do not need to build a Salesforce report or export manually. ExtendInsights generates the SOQL and prepares it for use directly in Excel.


Step 2: Validate and Update the Generated SOQL

After the query is generated, review and validate the results before downloading.

Preview Data

  1. In the ExtendInsights panel, click the arrow to expand the Configure section.

  2. Enable Preview Data.

  3. Click Proceed to preview the first 50 rows.

  4. Review the output and refine the SOQL if needed.

Edit a Query

To update or refine an existing query:

  1. In the ExtendInsights panel, click the arrow to expand the Configure section.

  2. In the SOQL box, click the maximize icon to reopen the SOQL builder.

  3. Edit the SOQL manually or regenerate it using a new AI prompt.

ExtendInsights supports both manual SOQL editing and AI-assisted generation in the same interface.


Step 3: Download Results

If you are satisfied with the SOQL and you want to download full results.

  1. Expand the Action section.

  2. Click Download to pull the full dataset into Excel.

Step 4: (Optional) Save your Query

If you plan to reuse the query:

  • Save it for quick access in the future

  • This makes it easier to rerun, update, or schedule later


Step 5 (Optional): Run or Schedule the Query

ExtendInsights lets you either run the query on demand or add it to a schedule for automated refresh.

Adhoc Query Run

From the Query pane:

  1. In the ExtendInsights panel, click the arrow to expand the Configure section.

  2. Expand the Action section.

  3. Click Download to pull the latest data to Excel

Schedule Management (Salesforce Queries)

You can schedule your Salesforce SOQL-based reports using the same scheduling framework as other ExtendInsights reports.

➡️ See article on how to add or manage schedules for your Salesforce queries

Once scheduled, ExtendInsights will automatically run the query and refresh your workbook based on the schedule you define.


Support for Custom Object Queries

  • Supports standard and custom Salesforce objects.

  • Custom objects and fields are supported as long as the connected role has access.

  • When querying custom objects or fields, use the exact API name.

⚠️ Incorrect or incomplete API names may result in query mismatches.


Notes & Limitations

  • Supports all standard Salesforce objects and fields for query generation.

  • Confidence rate: ~70% accuracy.

  • The prompt box is non-conversational; each response is based solely on the current prompt.

  • Multilingual support: works with all languages supported by GPT-4.1

  • AI may make mistakes review generated queries before use.

Did this answer your question?