Salesforce Agentforce

Customer Service

Customer Service

Best For:
  • 24/7 customer support automation
  • Case deflection and resolution
  • Multi-channel customer engagement
  • Escalation to human agents when needed
Availability & Implementation:
Generally Available

AI-powered autonomous agent that handles customer service inquiries across multiple channels

Setup: Setup > Agentforce > Service Agent

Key Capabilities
  • Natural language understanding
  • Case creation and resolution
  • Knowledge base integration
  • Seamless handoff to humans
Requirements
  • Service Cloud license
  • Agentforce Service Agent license
  • Knowledge base setup
  • Channel configuration
Service Agent Configuration

// Service Agent Configuration
{
  "name": "Customer_Support_Agent",
  "channels": ["Chat", "Messaging", "Voice"],
  "knowledgeBases": [
    "Product_Documentation",
    "FAQ_Knowledge_Base",
    "Troubleshooting_Guides"
  ],
  "actions": [
    {
      "name": "Create_Case",
      "type": "SALESFORCE_ACTION",
      "object": "Case",
      "fields": {
        "Subject": "{conversation.summary}",
        "Description": "{conversation.transcript}",
        "Priority": "{ai.determinePriority}",
        "Origin": "{channel.source}"
      }
    },
    {
      "name": "Search_Knowledge",
      "type": "KNOWLEDGE_SEARCH",
      "sources": ["Product_Documentation"],
      "confidence_threshold": 0.8
    }
  ],
  "escalationRules": [
    {
      "condition": "customer.sentiment < 0.3",
      "action": "TRANSFER_TO_HUMAN",
      "priority": "HIGH"
    },
    {
      "condition": "conversation.turns > 10",
      "action": "TRANSFER_TO_HUMAN",
      "priority": "MEDIUM"
    }
  ]
}

// Apex: Custom Action for Service Agent
@InvocableMethod(label='Process Refund Request')
public static List<RefundResult> processRefundRequest(List<RefundRequest> requests) {
    List<RefundResult> results = new List<RefundResult>();
    
    for(RefundRequest request : requests) {
        RefundResult result = new RefundResult();
        
        // Validate refund eligibility
        Order order = [SELECT Id, Status, TotalAmount, OrderDate 
                      FROM Order 
                      WHERE OrderNumber = :request.orderNumber];
        
        if(isRefundEligible(order)) {
            // Process refund
            Refund__c refund = new Refund__c(
                Order__c = order.Id,
                Amount__c = request.refundAmount,
                Reason__c = request.reason,
                Status__c = 'Pending'
            );
            insert refund;
            
            result.success = true;
            result.message = 'Refund processed successfully. Reference: ' + refund.Name;
        } else {
            result.success = false;
            result.message = 'Order not eligible for refund';
        }
        
        results.add(result);
    }
    
    return results;
}

Sales Development Agent

Sales

Best For:
  • Automated lead qualification
  • Meeting scheduling with prospects
  • Lead nurturing campaigns
  • Sales pipeline acceleration
Availability & Implementation:
General Available

AI agent that qualifies leads, schedules meetings, and nurtures prospects through the sales funnel

Setup: Setup > Agentforce > Sales Development Agent

Key Capablities
  • Lead scoring and qualification
  • Calendar integration
  • Email automation
  • CRM data enrichment
Requirements
  • Sales Cloud license
  • Agentforce SDR license
  • Email integration
  • Calendar system integration
Sales Development Agent Configuration

// Sales Development Agent Flow
{
  "name": "Lead_Qualification_Agent",
  "triggers": [
    {
      "type": "LEAD_CREATED",
      "conditions": {
        "lead.source": ["Website", "Event", "Referral"]
      }
    }
  ],
  "qualificationCriteria": {
    "budget": {
      "field": "Budget__c",
      "operator": "GREATER_THAN",
      "value": 50000
    },
    "authority": {
      "field": "Title",
      "values": ["Director", "VP", "Manager", "Owner"]
    },
    "need": {
      "field": "Pain_Points__c",
      "required": true
    },
    "timeline": {
      "field": "Timeline__c",
      "values": ["Immediate", "3 months", "6 months"]
    }
  },
  "actions": [
    {
      "name": "Send_Qualification_Email",
      "type": "EMAIL_TEMPLATE",
      "template": "Lead_Qualification_Questions",
      "timing": "IMMEDIATE"
    },
    {
      "name": "Schedule_Discovery_Call",
      "type": "CALENDAR_BOOKING",
      "duration": 30,
      "availability": "business_hours"
    },
    {
      "name": "Update_Lead_Score",
      "type": "SALESFORCE_UPDATE",
      "object": "Lead",
      "field": "Score__c",
      "value": "{ai.calculatedScore}"
    }
  ]
}

// Apex: Lead Scoring for Sales Agent
public class LeadScoringService {
    
    @InvocableMethod(label='Calculate Lead Score')
    public static List<Integer> calculateLeadScore(List<Id> leadIds) {
        List<Integer> scores = new List<Integer>();
        
        List<Lead> leads = [
            SELECT Industry, Title, Company, Budget__c, Timeline__c, 
                   Pain_Points__c, Lead_Source__c
            FROM Lead WHERE Id IN :leadIds
        ];
        
        for(Lead lead : leads) {
            Integer score = 0;
            
            // Industry scoring
            if(lead.Industry == 'Technology') score += 20;
            else if(lead.Industry == 'Financial Services') score += 15;
            
            // Title scoring
            if(lead.Title?.contains('VP') || lead.Title?.contains('Director')) score += 25;
            else if(lead.Title?.contains('Manager')) score += 15;
            
            // Budget scoring
            if(lead.Budget__c > 100000) score += 30;
            else if(lead.Budget__c > 50000) score += 20;
            
            // Timeline scoring
            if(lead.Timeline__c == 'Immediate') score += 25;
            else if(lead.Timeline__c == '3 months') score += 15;
            
            scores.add(Math.min(score, 100)); // Cap at 100
        }
        
        return scores;
    }
}

Marketing Agent

Marketing

Best For:
  • Automated campaign creation
  • A/B testing and optimization
  • Audience segmentation
  • Content personalization
Availability & Implementation:
pilot

AI-driven agent that creates, executes, and optimizes marketing campaigns across channels

Setup: Setup > Agentforce > Marketing Agent (Pilot)

Key Capabilities
  • Campaign strategy development
  • Content generation
  • Performance optimization
  • Cross-channel orchestration
Requirements
  • Marketing Cloud integration
  • Agentforce Marketing license
  • Campaign data available
  • Content approval workflows
Important Notes
  • Currently in pilot phase
  • Requires content review and approval
  • Performance improves with data volume
Marketing Agent Configuration

// Marketing Agent Campaign Configuration
{
  "name": "Product_Launch_Agent",
  "objective": "AWARENESS_AND_CONVERSION",
  "target_audience": {
    "segments": ["High_Value_Prospects", "Existing_Customers"],
    "criteria": {
      "industry": ["Technology", "Healthcare"],
      "company_size": "Enterprise",
      "engagement_score": "> 50"
    }
  },
  "channels": [
    {
      "type": "EMAIL",
      "cadence": "WEEKLY",
      "personalization": true
    },
    {
      "type": "SOCIAL_MEDIA",
      "platforms": ["LinkedIn", "Twitter"],
      "frequency": "DAILY"
    },
    {
      "type": "PAID_ADS",
      "platforms": ["Google", "LinkedIn"],
      "budget": 10000
    }
  ],
  "content_generation": {
    "email_templates": {
      "tone": "Professional",
      "length": "Medium",
      "cta_style": "Direct"
    },
    "social_posts": {
      "tone": "Engaging",
      "hashtags": true,
      "images": true
    }
  },
  "optimization": {
    "metrics": ["Open_Rate", "Click_Rate", "Conversion_Rate"],
    "a_b_testing": true,
    "auto_optimization": true
  }
}

// Apex: Campaign Performance Analysis
public class CampaignAnalytics {

    @InvocableMethod(label='Analyze Campaign Performance')
    public static List<CampaignInsight> analyzeCampaignPerformance(List<Id> campaignIds) {
        List<CampaignInsight> insights = new List<CampaignInsight>();
        
        List<Campaign> campaigns = [
            SELECT Id, Name, StartDate, EndDate, Status,
                   NumSent, NumConvertedLeads, ActualCost,
                   (SELECT Id, Status FROM CampaignMembers)
            FROM Campaign WHERE Id IN :campaignIds
        ];
        
        for(Campaign campaign : campaigns) {
            CampaignInsight insight = new CampaignInsight();
            insight.campaignId = campaign.Id;
            insight.conversionRate = (campaign.NumConvertedLeads / campaign.NumSent) * 100;
            insight.costPerConversion = campaign.ActualCost / campaign.NumConvertedLeads;
            
            // AI recommendations
            if(insight.conversionRate < 2.0) {
                insight.recommendations.add('Consider improving email subject lines');
                insight.recommendations.add('Test different send times');
            }
            
            if(insight.costPerConversion > 100) {
                insight.recommendations.add('Optimize audience targeting');
                insight.recommendations.add('Review ad creative performance');
            }
            
            insights.add(insight);
        }
        
        return insights;
    }
    
    public class CampaignInsight {
        @InvocableVariable public Id campaignId;
        @InvocableVariable public Decimal conversionRate;
        @InvocableVariable public Decimal costPerConversion;
        @InvocableVariable public List<String> recommendations = new List<String>();
    }
}

Commerce Agent

eCommerce

Best For:
  • Product recommendations
  • Shopping cart optimization
  • Customer support during purchase
  • Upselling and cross-selling
Availability & Implementation:
Beta

AI agent that enhances online shopping experiences with personalized recommendations and support

Setup: Setup > Agentforce > Commerce Agent (Beta)

Key Capabilities
  • Personalized product recommendations
  • Real-time inventory checking
  • Price optimization
  • Customer journey optimization
Requirements
  • Commerce Cloud integration
  • Product catalog data
  • Customer behavior tracking
  • Real-time inventory system
Important Note:
  • Currently in beta
  • Requires Commerce Cloud license
  • Performance improves with interaction data
Commerce Agent Configuration

// Commerce Agent Configuration
{
  "name": "Personal_Shopping_Assistant",
  "integration": {
    "commerce_platform": "Salesforce_Commerce_Cloud",
    "catalog_source": "Product_Catalog_API",
    "inventory_source": "Real_Time_Inventory"
  },
  "recommendation_engine": {
    "algorithms": ["Collaborative_Filtering", "Content_Based", "Hybrid"],
    "data_sources": [
      "Purchase_History",
      "Browsing_Behavior",
      "Customer_Preferences",
      "Similar_Customers"
    ],
    "real_time_updates": true
  },
  "personalization": {
    "factors": [
      "Customer_Segment",
      "Purchase_Intent",
      "Price_Sensitivity",
      "Brand_Preference"
    ]
  },
  "actions": [
    {
      "name": "Show_Recommendations",
      "trigger": "PAGE_VIEW",
      "max_products": 5
    },
    {
      "name": "Cart_Abandonment_Recovery",
      "trigger": "CART_IDLE_5_MINUTES",
      "discount_threshold": 10
    }
  ]
}

// Apex: Product Recommendation Engine
public class ProductRecommendationService {

    @AuraEnabled(cacheable=true)
    public static List<Product2> getPersonalizedRecommendations(Id customerId, String category) {

        // Get customer purchase history
        List<OrderItem> orderHistory = [
            SELECT Product2Id, Product2.Family, Quantity, UnitPrice
            FROM OrderItem
            WHERE Order.AccountId = :customerId
            ORDER BY CreatedDate DESC
            LIMIT 50
        ];

        // Analyze preferences
        Map<String, Decimal> categoryPreferences = analyzeCategoryPreferences(orderHistory);

        // Get recommended products
        List<Product2> recommendations = [
            SELECT Id, Name, Family, ListPrice, Description, ProductCode
            FROM Product2
            WHERE IsActive = true
            AND Family = :category
            AND Id NOT IN (
                SELECT Product2Id FROM OrderItem WHERE Order.AccountId = :customerId
            )
            ORDER BY LastModifiedDate DESC
            LIMIT 10
        ];

        return recommendations;
    }

    @InvocableMethod(label='Calculate Cross-sell Opportunities')
    public static List<CrossSellResult> calculateCrossSellOpportunities(List<Id> customerIds) {
        List<CrossSellResult> results = new List<CrossSellResult>();

        for(Id customerId : customerIds) {
            // Analyze customer's product portfolio
            Set<String> ownedCategories = getOwnedProductCategories(customerId);

            // Find complementary products
            List<Product2> crossSellProducts = [
                SELECT Id, Name, Family, ListPrice
                FROM Product2
                WHERE Family NOT IN :ownedCategories
                AND IsActive = true
                ORDER BY Family
            ];

            CrossSellResult result = new CrossSellResult();
            result.customerId = customerId;
            result.recommendedProducts = crossSellProducts;
            results.add(result);
        }

        return results;
    }

    public class CrossSellResult {
        @InvocableVariable public Id customerId;
        @InvocableVariable public List<Product2> recommendedProducts;
    }
}

Agentforce Comparison

Choose the right AI agent based on your business automation needs

Flow Type Security Level Use Case Type
Service Agent
Customer Service
Generally Available
Automated customer support
Sales Development Agent
Sales
Generally Available
Lead qualification and nurturing
Marketing Agent
Marketing
Pilot
Campaign automation and optimization
Commerce Agent
eCommerce
Beta
Personalized shopping assistance

Decision Tree

What business function needs AI automation?

Customer service and support: Service Agent

Lead qualification and sales: Sales Development Agent

Marketing campaigns: Sales Development Agent

eCommerce experience: Commerce Agent (Beta)

What is your implementation timeline?

Need it now (Production ready): Service Agent or Sales Development Agent

Can pilot new features: Marketing Agent or Commerce Agent

Implementation Roadmap

Getting Started (Production Ready)

  • Phase 1: Service Agent for customer support automation
  • Phase 2: Sales Development Agent for lead qualification
  • Phase 3: Expand to additional business functions

Future Planning (Pilot/Beta)

  • Marketing Agent: Campaign automation (Pilot)
  • Commerce Agent: Shopping experience (Beta)
  • Monitor feature maturity and plan adoption

Success Factors

Technical Requirements

  • Ensure proper licensing for chosen agents
  • Set up knowledge bases and training data
  • Configure escalation rules and handoffs
  • Test thoroughly before production deployment

Best Practices

  • Start with high-volume, routine tasks
  • Monitor agent performance continuously
  • Gather user feedback for improvements
  • Plan for change management and training