Configure Account Health Analysis Action
What This Action Does
This custom action allows your Agentforce sales agents to analyze account health by:
- Retrieving account data from Salesforce (opportunities, activities, contacts)
- Calculating health scores based on configurable criteria
- Providing actionable recommendations to sales reps
- Triggering follow-up tasks or alerts when needed
Step 1: Create the Flow Action
Build the Autolaunched Flow
- Navigate to Setup → Flows → New Flow
- Select "Autolaunched Flow (No Trigger)"
- Configure Input Variables:
Variable Name: accountId
Data Type: Text
Available for Input: ✓
Description: Salesforce Account ID to analyze
Variable Name: timeframeDays
Data Type: Number
Available for Input: ✓
Default Value: 90
Description: Number of days to look back for analysis
- Configure Output Variables:
Variable Name: healthScore
Data Type: Number
Available for Output: ✓
Description: Calculated health score (0-100)
Variable Name: riskLevel
Data Type: Text
Available for Output: ✓
Description: Risk assessment (Low/Medium/High)
Variable Name: recommendations
Data Type: Text
Available for Output: ✓
Description: AI-generated action recommendations
Flow Logic Elements
Get Account Data
- Get Records Element: Retrieve Account record
- Object: Account
- Filter: Id = {!accountId}
- Store in: accountRecord
Get Recent Activities
- Get Records Element: Query recent activities
- Object: Task/Event
- Filter: WhatId = {!accountId} AND CreatedDate = LAST_N_DAYS:{!timeframeDays}
- Store in: recentActivities
Get Open Opportunities
- Get Records Element: Query opportunities
- Object: Opportunity
- Filter: AccountId = {!accountId} AND IsClosed = false
- Store in: openOpportunities
Calculate Health Score
- Assignment Element: Calculate score based on:
- Activity frequency (30% weight)
- Opportunity pipeline value (40% weight)
- Contact engagement (30% weight)
Generate Recommendations
- Decision Element: Based on health score, set appropriate recommendations
Step 2: Create the Agent Action
Configure in Agent Studio
- Navigate to Setup → Agent Studio → Agent Actions
- Click "New" to create action
- Action Details:
Action Name: Analyze Account Health
Reference ID: analyze_account_health
Type: Flow
Flow: [Select your created flow]
Action Instructions
Configure clear instructions for when agents should use this action:
Instructions:
Use this action when a user asks about account health, account status,
or account performance. This action analyzes recent account activity,
opportunities, and engagement to provide a health assessment.
Example user requests:
- "How healthy is this account?"
- "What's the status of account ABC Corp?"
- "Should I be worried about this customer?"
Input Configuration
- Account ID: Required field that agents will provide
- Timeframe: Optional field (defaults to 90 days)
Output Configuration
- Show Health Score: Display the calculated score to users
- Show Risk Level: Present risk assessment clearly
- Show Recommendations: Provide actionable next steps
Step 3: Add Action to Agent Topic
Configure Sales Topic
- Navigate to Agent Studio → Agents → [Your Sales Agent]
- Go to Topics tab
- Select or create "Account Management" topic
- Add the action to this topic:
Topic Instructions:
You help sales reps manage their accounts and assess account health.
When users ask about account status or performance, use the Account
Health action to provide data-driven insights.
Action Assignment
- Action: Analyze Account Health
- When to Use: When users inquire about account status or health
- Required Info: Always ask for Account ID if not provided
Step 4: Test and Deploy
Testing Process
- Use Agent Builder Preview
- Test various user inputs:
- "How is ABC Corp doing?"
- "Analyze account health for [Account ID]"
- "What's the status of my biggest account?"
- Verify action executes correctly
- Check that outputs are formatted properly
Deployment Checklist
- [ ] Flow is activated and working
- [ ] Action is created and configured
- [ ] Agent instructions are clear
- [ ] Topic includes the action
- [ ] Testing is complete
- [ ] Agent is published
Common Configuration Issues
Flow Not Executing
- Check: Flow is activated
- Check: Input variables are properly mapped
- Check: User has proper permissions to access account data
Poor Action Recognition
- Issue: Agent doesn't recognize when to use action
- Fix: Improve topic instructions and example utterances
- Fix: Add more specific keywords and phrases
Incomplete Data
- Issue: Action returns blank or incomplete results
- Fix: Add null checks in flow logic
- Fix: Provide default values for missing data
- Fix: Add error handling for failed queries
Advanced Enhancements
Integration Options
- Connect to External Systems: Add callouts to other health scoring tools
- Email Notifications: Send alerts when health scores drop
- Slack Integration: Post updates to team channels
- Dashboard Updates: Write health scores back to Salesforce dashboards
Conversation Design Tips
- Be Specific: Train agents to ask for account names or IDs
- Provide Context: Include account name in responses
- Offer Follow-ups: Suggest next actions based on health score
- Handle Errors: Gracefully handle invalid account IDs
Performance Optimization
- Limit Data Queries: Only fetch necessary fields
- Use Efficient Filters: Add indexes on frequently queried fields
- Cache Results: Store recent health scores to avoid recalculation
- Bulk Processing: Handle multiple accounts efficiently
Real-World Use Cases
Scenario 1: Weekly Account Reviews
Sales manager asks: "Give me a health check on our top 5 accounts"
- Agent processes each account individually
- Provides summary health scores
- Flags accounts needing immediate attention
Scenario 2: Pre-Meeting Preparation
Sales rep asks: "I'm meeting with ABC Corp tomorrow. How are they doing?"
- Agent analyzes ABC Corp's recent activity
- Highlights recent opportunities or concerns
- Suggests talking points for the meeting
Scenario 3: Risk Identification
Sales director asks: "Which accounts should I be worried about?"
- Agent can analyze multiple accounts
- Identifies those with declining health scores
- Provides specific recommendations for each at-risk account