Solution Page
Audit open pipeline, surface dormant deals, and summarize weighted revenue risk from live Salesforce opportunity data.
Overview
For Sales, RevOps, Revenue leaders
Integrations: Salesforce, Pipeline health, Weighted revenue
• Pipeline risk summary
• Dormant deal list
• Weighted revenue analysis
• Creates a consistent pipeline review process.
• Surfaces risk earlier for managers and RevOps.
• Improves forecast conversations with structured evidence.
What It Solves
Pipeline reviews often rely on stale spreadsheets and subjective judgment instead of a repeatable signal layer.
Workflow
Pull live opportunity data from Salesforce.
Score pipeline quality, dormancy, and weighted revenue exposure.
Package the findings into a summary leaders can act on immediately.
Implementation
Review the underlying plan definition, inspect the template when available, and see how the workflow is encoded for repeatable execution.
Plan Code
Markdown Report
sales-opps.yaml
214 lines
## SALES Opportunity ANALYSIS - Frags 0.14 (Best Practice)
transformers:
- name: cleanup_opportunities
onFunctionOutput: queryOpportunity
# jsonata projection for Salesforce standardization
jsonata: |-
records.{
"id": Id,
"name": Name,
"account_id": AccountId,
"stage": StageName,
"amount": Amount,
"close_date": CloseDate,
"probability": Probability,
"owner_id": OwnerId,
"created_date": CreatedDate,
"last_modified_date": LastModifiedDate,
"last_activity_days_ago": LastActivityInDays,
"age_in_days": AgeInDays,
"is_closed": IsClosed,
"is_won": IsWon,
"lead_source": LeadSource,
"next_step": NextStep,
"forecast_category": ForecastCategoryName,
"has_open_activity": HasOpenActivity,
"has_overdue_task": HasOverdueTask,
"push_count": PushCount,
"last_stage_change_days_ago": LastStageChangeInDays,
"type": Type,
"description": Description
}
components:
schemas:
opportunity:
type: object
description: "A single Salesforce Opportunity record"
properties:
id:
type: string
description: "Unique Salesforce ID"
name:
type: string
description: "Opportunity Name"
account_id:
type: string
description: "Associated Account ID"
stage:
type: string
description: "Current Sales Stage"
amount:
type: number
description: "Total Deal Value"
close_date:
type: string
description: "Estimated Close Date"
probability:
type: number
description: "Win Probability Percentage"
owner_id:
type: string
description: "ID of the User owning the record"
created_date:
type: string
description: "Record Creation Timestamp"
last_modified_date:
type: string
description: "Record Modification Timestamp"
last_activity_days_ago:
type: integer
description: "Days since last recorded activity"
age_in_days:
type: integer
description: "Total days the opportunity has been open"
is_closed:
type: boolean
description: "Flag indicating if the deal is finished"
is_won:
type: boolean
description: "Flag indicating if the deal was successful"
lead_source:
type: string
description: "Origin of the lead"
next_step:
type: string
description: "The defined next action for this deal"
forecast_category:
type: string
description: "Sales forecast bucket name"
has_open_activity:
type: boolean
description: "Whether there are pending tasks"
has_overdue_task:
type: boolean
description: "Whether there are past-due tasks"
push_count:
type: integer
description: "Number of times the close date has been delayed"
last_stage_change_days_ago:
type: integer
description: "Days since the stage was last updated"
type:
type: string
description: "Opportunity business type"
description:
type: string
description: "Detailed notes on the opportunity"
sessions:
fetch-opportunities:
preCalls:
- name: queryOpportunity
args:
# Explicitly list fields to ensure you get everything needed
fields: [
"Id", "Name", "AccountId", "StageName", "Amount",
"CloseDate", "Probability", "OwnerId", "CreatedDate",
"LastModifiedDate", "LastActivityInDays", "AgeInDays",
"IsClosed", "IsWon", "LeadSource", "NextStep",
"ForecastCategoryName", "HasOpenActivity", "HasOverdueTask",
"PushCount", "LastStageChangeInDays", "Type", "Description"
]
# Filter to relevant opportunities
where: "IsClosed = false OR CloseDate >= LAST_N_DAYS:90"
limit: "200"
orderBy: "LastModifiedDate DESC"
prePrompt: |-
Process the Salesforce opportunity data retrieved via queryOpportunity.
Ensure every record is accurately mapped to the opportunities_data list.
prompt: "Extract Salesforce opportunities and map them to the opportunities_data list."
analyze-sales-pipeline:
context: true
dependsOn:
- session: fetch-opportunities
prePrompt: |-
Audit the collected opportunities_data:
1. Logic: 'dormant' if last_activity_days_ago > 7.
2. Weighted Value: (amount * (probability / 100)).
3. Stalled: stage unchanged for > 30 days and not closed.
prompt: "Generate the sales_report summarizing pipeline health and risk."
schema:
type: object
AdditionalProperties: false
required:
- sales_report
- opportunities_data
properties:
sales_report:
x-session: analyze-sales-pipeline
x-phase: 2
type: object
required:
- executive_summary
- activity_breakdown
- high_risk_deals
description: "Comprehensive analytical report of the sales pipeline"
AdditionalProperties: false
properties:
executive_summary:
type: object
description: "Executive-level briefing on pipeline status"
required:
- headline
- total_pipeline_value
- weighted_pipeline_value
- pipeline_at_risk
- top_priority_action
properties:
headline:
type: string
description: "A one-sentence critical summary of current pipeline health."
total_pipeline_value:
type: number
description: "Sum of all open opportunity amounts."
weighted_pipeline_value:
type: number
description: "Sum of weighted values (amount * probability) for open deals."
pipeline_at_risk:
type: boolean
description: "True if over 40% of deals are dormant or stalled."
top_priority_action:
type: string
description: "The single most urgent task required to protect revenue."
activity_breakdown:
type: object
description: "Analysis of team engagement with deals"
AdditionalProperties: false
properties:
active_count: { type: integer, description: "Total opportunities with activity in < 7 days" }
dormant_count: { type: integer, description: "Total opportunities with no activity for > 7 days" }
active_percentage: { type: number, description: "Ratio of active deals to total open deals" }
high_risk_deals:
type: array
description: "List of open deals identified as likely to fail or slip"
items:
type: object
AdditionalProperties: false
properties:
opportunity_name: { type: string, description: "Name of the deal" }
risk_reason: { type: string, description: "Why this deal is flagged (e.g. 'Stalled and Dormant')" }
amount: { type: number, description: "Potential loss value" }
opportunities_data:
x-session: fetch-opportunities
x-phase: 0
type: array
description: "Raw repository of opportunity data from Salesforce"
items:
$ref: "#/components/schemas/opportunity"