SalesforceOutline

Snapshot Salesforce query results into Outline docs

A Salesforce + Outline agent flow

Pipeline numbers age the moment someone screenshots them into a deck. A week later nobody can say what the board looked like on the day a deal was supposedly committed. This recipe keeps a dated paper trail in your team wiki. The agent runs a SOQL query you've defined, say every Opportunity that closed or changed stage since yesterday, with run_soql_query, then writes the result as an Outline document with create_document: a timestamped snapshot the whole team can read and link to. Salesforce answers the query when asked, so the agent runs on a cadence, end of day or start of week, and each run produces one new dated doc rather than overwriting the last.

The flow

Salesforcerun_soql_query

Runs a SOQL query against a Salesforce org.

Outlinecreate_document

Creates a new document.

Step by step

  1. Define the SOQL

    You pin the exact query: which object, which fields, which filter. The agent calls run_soql_query and gets back rows, for example Opportunity name, amount, stage, and close date for everything modified in the window.

  2. Render to markdown

    The agent turns the rows into a readable table or summary, adds the run date and the query window, and a short headline like the count and total amount.

  3. Create the dated doc

    create_document writes the snapshot into a chosen Outline collection, titled with the date, so the collection becomes a chronological archive of pipeline states.

Tell your agent

Each weekday at 6pm, run my saved SOQL query for opportunities changed today, format the rows as a table, and create an Outline document titled with today's date in the Pipeline Snapshots collection. Include the total count and amount at the top.

Setup

This flow needs both servers connected to your agent. Follow each install guide:

Worth knowing

  • run_soql_query returns only the fields your SELECT names and is governed by Salesforce query limits. Keep the field list and row count bounded, and paginate with LIMIT/OFFSET or a query locator if the result set is large.
  • create_document makes a brand-new document every run by design, which is what you want for an archive but means the collection grows steadily. Decide on a retention or folder-by-month convention up front so it stays navigable.
  • SOQL relationship fields and currency formatting come back raw. The agent should format amounts and resolve related-record names in the rendering step, or the doc reads as a dump of ids instead of a readable snapshot.
  • Org permissions apply to the connected user. A field the agent's user can't see won't appear in results, so confirm the query user has read access to every field your snapshot relies on.

Questions

Why archive snapshots instead of querying Salesforce live?
A live query shows the current state and erases history. SOQL has no built-in way to ask what the pipeline looked like last Tuesday unless you captured it. The dated docs give you that point-in-time record for retros and board reporting.
Can it diff against the previous snapshot?
The agent can read the prior Outline doc, compare row sets, and write a what-changed section. That's an extra read and a bit of reconciliation logic, but it turns the archive into a changelog rather than a pile of standalone tables.