APM

>Agent Skill

@microsoft/daily-briefing

skillproductivity

Delivers a prioritized morning summary covering today's meetings, overdue tasks, pipeline alerts, and recommended actions from Dataverse. Use when user says "what's on my plate today", "daily briefing", "morning summary", "what do I need to focus on today", "start my day", "daily digest", "today's priorities", or "what's happening today".

productivity
apm::install
$apm install @microsoft/daily-briefing
apm::skill.md
---
name: daily-briefing
description: Delivers a prioritized morning summary covering today's meetings, overdue tasks, pipeline alerts, and recommended actions from Dataverse. Use when user says "what's on my plate today", "daily briefing", "morning summary", "what do I need to focus on today", "start my day", "daily digest", "today's priorities", or "what's happening today".
metadata:
  author: Dataverse
  version: 1.0.0
  category: sales-productivity
---

# Daily Briefing

Sales reps lose time each morning deciding what to work on. This skill queries Dataverse to surface the day's agenda, flag urgent pipeline issues, highlight overdue commitments, and recommend a prioritized action list. It replaces manual CRM scanning with a structured, actionable daily digest.

## Instructions

### Step 1: Determine Scope
Accept optional parameters from the user:
- **Owner filter:** Specific rep (systemuserid or name) or default to current user
- **Date:** Today (default) or a specified date

Calculate the target date range:
- Day start: `[target_date]T00:00:00Z`
- Day end: `[target_date]T23:59:59Z`

#### Step 2: Fetch Today's Scheduled Meetings
```
SELECT appointmentid, subject, scheduledstart, scheduledend, description,
       regardingobjectid, regardingobjecttypecode, location, ownerid
FROM appointment
WHERE statecode = 0
AND scheduledstart >= '[day_start]'
AND scheduledstart <= '[day_end]'
AND ownerid = '[ownerid]'
ORDER BY scheduledstart ASC
```

For each appointment, fetch the regarding record name (account or opportunity) and attendees:
```
SELECT partyid, participationtypemask
FROM activityparty
WHERE activityid = '[appointmentid]'
```

#### Step 3: Fetch Overdue and Due-Today Tasks
**Overdue tasks (past due, still open):**
```
SELECT taskid, subject, description, scheduledend, prioritycode,
       regardingobjectid, regardingobjecttypecode, ownerid
FROM task
WHERE statecode = 0
AND scheduledend < '[day_start]'
AND ownerid = '[ownerid]'
ORDER BY scheduledend ASC
```

**Due today:**
```
SELECT taskid, subject, description, scheduledend, prioritycode,
       regardingobjectid, regardingobjecttypecode, ownerid
FROM task
WHERE statecode = 0
AND scheduledend >= '[day_start]'
AND scheduledend <= '[day_end]'
AND ownerid = '[ownerid]'
ORDER BY prioritycode ASC
```

**Priority codes:** 0 = High, 1 = Normal, 2 = Low

#### Step 4: Pipeline Alerts
Identify opportunities requiring immediate attention today.

**Deals closing this month with no recent activity:**
```
SELECT opportunityid, name, estimatedvalue, estimatedclosedate, salesstage,
       closeprobability, msdyn_forecastcategory, ownerid, customerid
FROM opportunity
WHERE statecode = 0
AND ownerid = '[ownerid]'
AND estimatedclosedate <= '[end_of_month]'
ORDER BY estimatedclosedate ASC
```

For each, check last activity date:
```
SELECT TOP 1 actualend
FROM activitypointer
WHERE regardingobjectid = '[opportunityid]'
AND statecode = 1
ORDER BY actualend DESC
```

**Flag deals where:** last activity > 7 days ago AND close date is within 30 days.

**Deals with past-due close dates:**
```
SELECT opportunityid, name, estimatedvalue, estimatedclosedate, salesstage, ownerid
FROM opportunity
WHERE statecode = 0
AND ownerid = '[ownerid]'
AND estimatedclosedate < '[today]'
ORDER BY estimatedclosedate ASC
```

**Deals newly moved to Lost (yesterday):**
```
SELECT opportunityid, name, estimatedvalue, actualclosedate, ownerid
FROM opportunity
WHERE statecode = 2
AND ownerid = '[ownerid]'
AND actualclosedate >= '[yesterday_start]'
AND actualclosedate <= '[yesterday_end]'
```

#### Step 5: New Leads Assigned
```
SELECT leadid, fullname, companyname, jobtitle, leadqualitycode,
       leadsourcecode, createdon, ownerid
FROM lead
WHERE statecode = 0
AND ownerid = '[ownerid]'
AND createdon >= '[yesterday_start]'
ORDER BY createdon DESC
```

#### Step 6: Recent Email Activity (Unanswered)
Identify emails received but not yet responded to:
```
SELECT activityid, subject, createdon, regardingobjectid, regardingobjecttypecode
FROM email
WHERE statecode = 1
AND directioncode = 0
AND ownerid = '[ownerid]'
AND createdon >= '[two_days_ago]'
ORDER BY createdon DESC
```

**directioncode:** 1 = Outgoing, 0 = Incoming

Limit to 10 most recent. Flag if no outgoing reply found on same regardingobjectid within last 24 hours.

#### Step 7: Yesterday's Activity Summary
Count completed activities from yesterday to provide context:
```
SELECT activitytypecode, COUNT(activityid) as count
FROM activitypointer
WHERE statecode = 1
AND ownerid = '[ownerid]'
AND actualend >= '[yesterday_start]'
AND actualend <= '[yesterday_end]'
GROUP BY activitytypecode
```

#### Step 8: Generate Prioritized Action List
Combine all findings and rank actions:

**Priority 1 — Do First (Urgent):**
- Overdue tasks with High priority
- Deals closing this week with no recent activity
- Past-due close dates
- Escalated support cases tied to your accounts

**Priority 2 — Do Today (Important):**
- Due-today tasks
- Meetings requiring prep (within 2 hours)
- New leads uncontacted for >24 hours
- Pipeline deals closing this month in late stages (Propose/Close)

**Priority 3 — Do When Possible (Normal):**
- Unanswered emails from key contacts
- Deals in Qualify/Develop closing this quarter
- Low priority tasks due today

#### Step 9: Output Daily Briefing

```
GOOD MORNING — DAILY SALES BRIEFING
[Date] | [Owner Name]
═══════════════════════════════════════════════════════════

TODAY'S SCHEDULE
───────────────────────────────────────────────────────────
[Time] - [Meeting Subject] | [Attendees] | [Account/Opp]
[Time] - [Meeting Subject] | [Attendees] | [Account/Opp]

URGENT — ACTION REQUIRED NOW
───────────────────────────────────────────────────────────
🔴 [Overdue task or pipeline alert with context]
🔴 [Past-due close date deal with recommended action]

TODAY'S TASKS ([n] total)
───────────────────────────────────────────────────────────
⬜ [High Priority] [Task subject] — [Account/Opp] — Due: Today
⬜ [Normal] [Task subject] — [Account/Opp] — Due: Today

PIPELINE ALERTS ([n] deals need attention)
───────────────────────────────────────────────────────────
⚠️  [Deal Name] — $[Value] | [Stage] | Close: [Date]
    Last activity: [n] days ago | [Recommended action]

NEW LEADS ([n] new)
───────────────────────────────────────────────────────────
👤 [Name] — [Company] | [Title] | [Source] | Assigned [n] hours ago

EMAILS TO FOLLOW UP ([n] unanswered)
───────────────────────────────────────────────────────────
📧 [Subject] from [Contact] — [Account] — [n] hours ago

YESTERDAY'S ACTIVITY
───────────────────────────────────────────────────────────
✓ [n] calls | [n] meetings | [n] emails | [n] tasks completed

RECOMMENDED FOCUS FOR TODAY
───────────────────────────────────────────────────────────
1. [Specific action #1 with context]
2. [Specific action #2 with context]
3. [Specific action #3 with context]
═══════════════════════════════════════════════════════════
```

### Output Format
The briefing is designed to be read in under 2 minutes. Each section leads with the most urgent items. The Recommended Focus section synthesizes across all sections to give reps a clear starting point.

### Example Interaction

**User Input:**
"Give me my daily briefing."

**Skill Output:**
```
GOOD MORNING — DAILY SALES BRIEFING
Tuesday, March 3 | Sarah Johnson
═══════════════════════════════════════════════════════════

TODAY'S SCHEDULE (2 meetings)
───────────────────────────────────────────────────────────
10:00 AM - QBR with Fabrikam | Emily Torres, James Liu | Cloud Migration Deal
 2:00 PM - Intro Call: Contoso | Mark Evans (VP Sales) | New Lead

URGENT — ACTION REQUIRED NOW
───────────────────────────────────────────────────────────
🔴 OVERDUE TASK: "Send updated SOW to Fabrikam" — was due 5 days ago
    → Send before your 10am call with Emily Torres

🔴 PAST-DUE DEAL: Northwind Renewals — $42,000 | Propose stage
    Close date was Feb 28 | Last activity: 12 days ago
    → Reschedule close date or re-engage today

TODAY'S TASKS (3 tasks)
───────────────────────────────────────────────────────────
⬜ [High] Send updated SOW to Fabrikam — Due: Today (overdue!)
⬜ [Normal] Follow up: Alpine Ski House pricing question — Due: Today
⬜ [Normal] Log notes from Friday's Woodgrove demo — Due: Today

PIPELINE ALERTS (2 deals)
───────────────────────────────────────────────────────────
⚠️  Fabrikam Cloud Migration — $85,000 | Propose | Close: Mar 31
    Last activity: 18 days ago | Attend today's QBR prepared
⚠️  Northwind Renewals — $42,000 | Propose | Close: Feb 28 (PAST DUE)
    Last activity: 12 days ago | Reschedule or re-engage

NEW LEADS (1 new)
───────────────────────────────────────────────────────────
👤 Mark Evans — Contoso | VP of Sales | Inbound Web | Assigned 4 hours ago
   → You have an intro call at 2pm — prep recommended

EMAILS TO FOLLOW UP (2 unanswered)
───────────────────────────────────────────────────────────
📧 "Re: Pricing proposal" from Lisa Chen — Alpine Ski House — 26 hours ago
📧 "Quick question on implementation timeline" from Tom Park — Woodgrove — 8 hours ago

YESTERDAY'S ACTIVITY
───────────────────────────────────────────────────────────
✓ 2 calls | 1 meeting | 4 emails | 3 tasks completed

RECOMMENDED FOCUS FOR TODAY
───────────────────────────────────────────────────────────
1. Prep for Fabrikam QBR + send overdue SOW before 10am
2. Re-engage Northwind Renewals — update close date or escalate
3. Review Alpine Ski House email and reply with pricing clarity
═══════════════════════════════════════════════════════════
```

### Dataverse Tables Used
| Table | Purpose |
|-------|---------|
| `appointment` | Today's scheduled meetings |
| `activityparty` | Meeting attendees |
| `task` | Overdue and due-today tasks |
| `opportunity` | Pipeline alerts and close-date monitoring |
| `activitypointer` | Recent activity check per opportunity |
| `lead` | New leads assigned |
| `email` | Unanswered inbound emails |
| `systemuser` | Owner context |

### Key Fields Reference
**task:**
- `subject` (NVARCHAR 200) - Task title
- `scheduledend` (DATETIME) - Due date
- `prioritycode` (CHOICE) - High(0), Normal(1), Low(2)
- `statecode` (STATE) - Open(0), Completed(1), Canceled(2)
- `regardingobjectid` (LOOKUP) - Linked account, contact, or opportunity

**email:**
- `directioncode` (BIT) - Outgoing(1), Incoming(0)
- `statecode` (STATE) - Draft(0), Completed(1), Canceled(2), Pending Send(3), Sending(4), Failed(5)
- `createdon` (DATETIME) - When received/sent
- `regardingobjectid` (LOOKUP) - Linked record

### Configurable Parameters
- Days without activity threshold for pipeline alerts (default: 7)
- Email age threshold for follow-up alerts (default: 24 hours)
- New lead contact SLA (default: 24 hours)
- Number of days to look back for lost deals (default: 1)

## Examples

### Example 1: Standard Morning Briefing

**User says:** "What's on my plate today?"

**Actions:**
1. Query today's appointments for current user
2. Fetch overdue and due-today tasks
3. Identify pipeline alerts (stale deals, past-due close dates)
4. Check for new leads and unanswered emails
5. Generate prioritized daily briefing

**Result:**
```
DAILY BRIEFING - Wednesday, March 4, 2026

TODAY'S AGENDA:
9:00am - Contoso QBR (Teams) - Prep: Review Q4 metrics
2:00pm - New lead intro call - Mark Evans, Contoso

URGENT TASKS:
⚠️ Send SOW to Fabrikam (overdue since yesterday)
⚠️ Follow up on Alpine pricing question

PIPELINE ALERTS:
- Northwind $42K: Close date passed, re-engage or update
- Fabrikam $85K: No activity 18 days, QBR today

TOP 3 PRIORITIES:
1. Prep for Contoso QBR (starts in 2 hours)
2. Send Fabrikam SOW before QBR at 10am
3. Reply to Alpine email before EOD
```

### Example 2: Briefing for Specific Date

**User says:** "What's happening tomorrow?"

**Actions:**
1. Calculate tomorrow's date range
2. Run same queries with tomorrow's date
3. Generate forward-looking briefing

**Result:**
```
BRIEFING FOR THURSDAY, MARCH 5, 2026

SCHEDULED:
10:00am - Alpine Ski House Demo
3:30pm - Woodgrove Technical Review

TASKS DUE:
- Prepare demo environment for Alpine
- Send meeting agenda for Woodgrove

RECOMMENDATION:
Light meeting day - use morning for deal follow-ups
```

### Example 3: Quick Priority Check

**User says:** "What should I focus on right now?"

**Actions:**
1. Check next 2 hours of calendar
2. Identify highest priority overdue items
3. Generate focused action list

**Result:**
```
RIGHT NOW PRIORITIES:

1. Meeting in 45 min: Contoso QBR - prep slides
2. Overdue: Fabrikam SOW (flagged 2x by manager)
3. Stale deal: Northwind hasn't been touched in 12 days

After 11am: You have 3 hours clear for deep work
```

## Troubleshooting

### Error: No appointments found
**Cause:** User has no scheduled meetings or calendar not synced
**Solution:**
- Verify appointment table is populated
- Check if meetings are on shared calendars
- Fall back to task-focused briefing

### Error: Too many items returned
**Cause:** User has large portfolio or many overdue items
**Solution:**
- Limit to top 5 per category
- Prioritize by value and urgency
- Suggest separate deep-dive for full list

### Error: Email follow-up data incomplete
**Cause:** Email tracking not enabled or emails not synced to Dynamics
**Solution:**
- Check if server-side sync is configured
- Fall back to task and meeting focus
- Note email section as unavailable