salesintermediate10 min setupby Mantle

Weekly Salesforce pipeline digest

Run a SOQL query against open opportunities every Monday and e-mail the result to the sales lead.

Mondays 08:00Open opportunitiE-mail the diges

Drag to pan, pinch to zoom. This is the real graph the template installs.

Purpose

Run a SOQL query against open opportunities every Monday and e-mail the result to the sales lead.

How it works

What it does

  • Runs every Monday at 08:00.
  • Queries Salesforce for open opportunities, largest first.
  • E-mails the totals and the records to the sales lead.

Validation

This template is contract-validated: the unit suite checks every node type, every config key and the whole graph against the same rules a saved workflow passes. It has not been run against the live provider — the ids, names and columns below are placeholders to replace with your own.

Nodes 3

  1. 01Mondays 08:00trigger.scheduleTrigger
  2. 02Open opportunitiessalesforce.queryApp
  3. 03E-mail the digestmail.sendDestination
View template JSON
{
  "format": "mantle-workflow/v1",
  "id": "salesforce-pipeline-digest-email",
  "name": "Weekly Salesforce pipeline digest",
  "graph": {
    "nodes": [
      {
        "id": "cron",
        "type": "trigger.schedule",
        "label": "Mondays 08:00",
        "config": {
          "cron_expr": "0 8 * * 1",
          "timezone": "UTC"
        },
        "worker_type": "generic-worker",
        "position": {
          "x": 60,
          "y": 220
        }
      },
      {
        "id": "query",
        "type": "salesforce.query",
        "label": "Open opportunities",
        "config": {
          "soql": "SELECT Id, Name, Amount, StageName, CloseDate, Owner.Name FROM Opportunity WHERE IsClosed = false ORDER BY Amount DESC LIMIT 50"
        },
        "worker_type": "generic-worker",
        "position": {
          "x": 380,
          "y": 220
        }
      },
      {
        "id": "email",
        "type": "mail.send",
        "label": "E-mail the digest",
        "config": {
          "to": "sales-lead@example.com",
          "subject": "Pipeline digest — {{ $today }}",
          "body_text": "{{ steps.query.total }} open opportunit(ies); top {{ steps.query.count }} below.\n\n{{ steps.query.records }}"
        },
        "worker_type": "generic-worker",
        "position": {
          "x": 700,
          "y": 220
        }
      }
    ],
    "edges": [
      {
        "from": "cron",
        "to": "query"
      },
      {
        "from": "query",
        "to": "email"
      }
    ]
  }
}

Requirements

The connections and permissions each step needs, from the node contracts in the catalog.

  • SalesforceOAuth 2.0

    Used by Open opportunities.

    Credential: {"client_id", "client_secret", "refresh_token"}

  • SendGridAPI key

    Used by E-mail the digest.

    Credential: {"api_key"} or {"username", "password"}

Setup

  • Edit the soql — it is an ordinary SOQL string, so any object and any filter works.
  • Pick a Salesforce connection (its login_url config key selects production or a sandbox) and a mail connection.
  • Change the recipient in to.

Sample input and output

Synthetic examples: node-contract samples or placeholders, never customer data.

Input

Runs on the cron schedule 0 8 * * 1 (UTC). There is no incoming payload: the first step fetches the data.

Output

E-mail the digest mail.send

{
  "body": null,
  "message_id": "",
  "provider": "",
  "sent": true,
  "status_code": 0,
  "thread_id": ""
}

Failure handling

What the graph does when a step fails, read from its retry settings, error branches and error policies.

  • A step that fails, after any retries, fails the run. The failed step is kept with its input and error.

See it run, then make it yours.

Templates install as drafts. Edit any step, and Workflow Health re-checks the graph on every save.