93 lines
Revenue Workflows

Solution Page

Sales Weekly Audit

Score the week as good, bad, and ugly with rep-level coaching notes and clear risk signals for leadership.

Sales managers
RevOps
Revenue leaders
Salesforce
Scorecards
Manager notes

Overview

For Sales managers, RevOps, Revenue leaders

Integrations: Salesforce, Scorecards, Manager notes

Weekly audit summary

Rep scorecards

Coaching notes

Risk flags

Turns weekly inspection into a repeatable operating cadence.

Helps managers coach from evidence instead of anecdotes.

Makes sales quality visible beyond topline pipeline numbers.

What It Solves

Weekly sales reviews are usually assembled by hand and rarely produce the same management view twice in a row.

Workflow

1

Read sales activity and opportunity data from the source system.

2

Classify the week into healthy, risky, and urgent patterns.

3

Generate manager-ready scorecards and coaching notes for action.

Implementation

Review the underlying plan definition, inspect the template when available, and see how the workflow is encoded for repeatable execution.

Plan Code

sales-audit.yaml

93 lines

## SALES WEEKLY AUDIT - Version 0.24
## THE GOOD, THE BAD, AND THE UGLY (Momentum vs. Rot) ./frags run -d ./examples/sales-audit.yaml -o './examples/sales-audit-output.yaml'

transformers:
  - name: cleanup_audit_opps
    onFunctionOutput: queryOpportunity
    jsonata: |-
      records.{
        "id": Id,
        "name": Name,
        "owner": Owner.Name,
        "stage": StageName,
        "amount": Amount != null ? Amount : 0,
        "close_date": CloseDate,
        "days_to_close": ($toMillis(CloseDate) - $millis()) / 86400000,
        "days_since_activity": LastActivityInDays,
        "is_good": (LastActivityInDays <= 3) and (PushCount = 0) and (IsClosed = false),
        "is_bad": (($toMillis(CloseDate) - $millis()) / 86400000 < 30) and (LastActivityInDays > 7),
        "is_ugly": (LastActivityInDays > 60) or (($toMillis(CloseDate) - $millis()) / 86400000 < -60)
      }

components:
  schemas:
    opportunity:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        owner: { type: string }
        amount: { type: number }
        days_since_activity: { type: integer }
        is_good: { type: boolean }
        is_bad: { type: boolean }
        is_ugly: { type: boolean }

sessions:
  fetch-audit-data:
    preCalls:
      - name: queryOpportunity
        args:
          fields: ["Id", "Name", "Owner.Name", "StageName", "Amount", "CloseDate", "LastModifiedDate", "LastActivityInDays", "LastStageChangeInDays", "IsClosed", "PushCount"]
          limit: 25
    prompt: "Retrieve pipeline data and map to raw_audit_data."

  rep-performance-audit:
    dependsOn:
      - session: fetch-audit-data
    context: true
    iterateOn: "unique(map(context.raw_audit_data, .owner))"
    prePrompt: |-
      Audit Rep: {{ .it }}. 
      1. Count 'is_good', 'is_bad', and 'is_ugly' deals.
      2. Calculate 'activity_velocity' as the average of 'days_since_activity'.
      3. Sum 'amount' of 'is_ugly' deals for 'pipeline_rot_value'.
    prompt: "Generate the Good/Bad/Ugly scorecard for {{ .it }}."

  weekly-meeting-summary:
    dependsOn:
      - session: rep-performance-audit
    context: true
    prePrompt: |-
      Aggregate team totals:
      1. Sum 'amount' of all 'is_bad' deals for 'total_at_risk_value'.
      2. Sum 'amount' of all 'is_ugly' deals for 'total_rot_value'.
    prompt: "Produce the final sales_weekly_report headline and notes."

schema:
  type: object
  properties:
    raw_audit_data:
      type: array
      x-session: fetch-audit-data
      items: { $ref: '#/components/schemas/opportunity' }
    repScorecards:
      type: array
      x-session: rep-performance-audit
      items:
        type: object
        properties:
          rep_name: { type: string }
          activity_velocity: { type: number }
          good_count: { type: integer }
          bad_count: { type: integer }
          ugly_count: { type: integer }
          pipeline_rot_value: { type: number }
    salesWeeklyReport:
      type: object
      x-session: weekly-meeting-summary
      properties:
        meeting_headline: { type: string }
        total_at_risk_value: { type: number }
        total_rot_value: { type: number }
        manager_coaching_notes: { type: array, items: { type: string } }