Похожие презентации:
AI_Sales_Assistant_Salesforce_Presentation
1.
AI SALES ASSISTANTBUILDING AN AI SALES ASSISTANT
IN SALESFORCE
User request
Creating, configuring, testing and extending an Agentforce Employee Agent
Agent Router
Agentforce Employee Agent
Custom Apex
Flow + CRM
Subagent → Action
Practical developer perspective: architecture • trade-offs • problems • risks
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
1
2.
Why Use an AI Agent in Salesforce?An Agent is more than a chatbot: it can reason over context and execute Salesforce actions.
1 Understand intent
2 Use Salesforce context
3 Take an action
Turn a natural-language request into a
business goal.
Retrieve CRM records, stored AI results,
Tasks, Opportunities or Knowledge.
Run a Flow, Apex action, standard action, or
other supported capability — then respond.
Example: “How engaged is this Lead?”
User request
Agent reasoning
Action / data
Answer
Salesforce: Agentforce Builder / subagents / actions overview.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
2
3.
AI in Salesforce: Where Does It Fit?Think of Agentforce as an orchestration layer on top of familiar Salesforce building blocks.
Prompt
Flow
Apex
Agent
Generate / summarize / classify
Deterministic business process
Custom code and business
logic
Reasoning + context + action
selection
Key idea
AI does not replace Flow or Apex. The Agent decides which existing capability is appropriate for the request.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
3
4.
How the AI Sales Assistant Is StructuredThe architecture separates responsibilities instead of putting every capability in one place.
AI Sales Assistant
Agent Router
lead_research
lead_qualification
opportunity_review
task_creation
Identify • summarize
engagement
Qualification score • level
Deal health • risk • pipeline
Create follow-up Task via Flow
User intent → subagent → action → Salesforce result
Salesforce: Subagents are jobs an agent can do; subagents contain actions and instructions.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
4
5.
What Happens When a User Asks a Question?Example: “How engaged is Test Zerowko?”
User question
Agent Router
What the trace should show
1. Transition to lead_research
2. Identify Record By Name
3. Get Lead Activity and Open Tasks
4. Response uses Apex output
lead_research
Custom Apex
Response
SCREENSHOT / LIVE VIEW
Agent Builder Trace / Interaction Summary
Insert your real trace screenshot
Salesforce Trace Panel shows selected subagents, triggered actions, transitions and variable changes.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
5
6.
Choosing the Right Tool: Standard, Flow, Prompt or Apex?The goal is not to maximize customization — it is to use the simplest capability that fits.
Standard action
Flow action
Prompt action
Apex action
Use when Salesforce already
provides the required behavior.
Use for deterministic record
operations and business
processes.
Use when
generation/classification itself
is the main operation.
Use when custom code,
complex queries or business
logic add real value.
Example:
Create Follow Up Task
Example:
AI Summary / Classification
Example:
Lead Engagement Insights
Example:
Query Records
Rule of thumb
Start with standard capability. Add Flow/Prompt/Apex when a real gap or business requirement exists.
Salesforce: custom actions can be built on invocable Apex, autolaunched flows, prompt templates, REST Apex, external services and MuleSoft APIs.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
6
7.
Project Evolution: From AI Features to AgentsThe work progressed from isolated AI capabilities to orchestration and customer-facing automation.
1
2
3
4
5
6
7
Lead Summary
Lead Qualification
Case Summary
Opportunity Health
Email Automation
Employee Agent
Customer Support
Agent
Foundation
Automation
Agents
Prompt Builder + stored AI outputs
Flow + EmailMessage + CRM updates
Employee + Customer Support
Individual AI capabilities
AI becomes operational
AI orchestrates data and actions
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
7
8.
Keep AI Results in CRM: Calculate Once, Reuse EverywhereA useful pattern is to store the current business result in Salesforce instead of recalculating it in every conversation.
Lead data
AI qualification process
AI_Qualification__c / Score / Details
Bad pattern
Preferred pattern
Every Agent request → recalculate qualification
Qualification process → store result → Agent reads current CRM
value
• duplicated logic
• inconsistent behavior
• more maintenance
• one source of truth
• reusable result
• easier governance
This is especially useful when multiple entry points need the same business result.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
8
9.
Lead Research: Same Object, Different IntentThe agent does not use one tool for every Lead question. Intent changes the required action.
User request
Action / route
Purpose
“Find Test Zerowko.”
IdentifyRecordByName
Basic retrieval
SCREENSHOT / LIVE VIEW
Agent Builder — Trace
Insert the routing / action trace
“Tell me about Test Zerowko.”
SummarizeRecord
AI summary
SCREENSHOT / LIVE VIEW
“What is Test Zerowko’s qualification score?”
lead_qualification
Stored CRM value
Agent Preview
“How engaged is Test Zerowko?”
Get Lead Activity and Open
Tasks
Custom business logic
Insert one real interaction screenshot
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
9
10.
Flow or Apex for Lead Engagement?Both are valid. The choice depends on complexity, maintainability and how much custom logic you need.
Option A — Flow
Option B — Apex
Lead Id
↓
Get Lead
↓
Get Tasks
↓
Loop / count open Tasks
↓
Decision / Formula
↓
Return outputs
Lead Id
↓
One Lead SOQL
↓
Aggregate Task query
↓
Custom engagement logic
↓
Structured Response
Best fit: deterministic business process, record updates, low-to-medium logic
complexity.
Best fit: custom code, aggregates, reusable logic, complex collections and
bulkification.
What I would say
“This could be implemented with Flow. I chose Apex because the action combines aggregate SOQL with custom engagement logic in
a compact, bulkified implementation.”
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
10
11.
Custom Apex Action: What Did We Actually Build?The important part is not the code itself — it is the contract between Agentforce and Salesforce logic.
Request
Lead Id
@InvocableMethod
@InvocableMethod
public static List<Response> getInsights(
List<Request> requests
)
SOQL +
Aggregate SOQL
Response
Engagement + Tasks + Activity
SELECT WhoId, COUNT(Id) openTaskCount
FROM Task
WHERE WhoId IN :leadIds
AND Status != 'Completed'
GROUP BY WhoId
@InvocableVariable
public Id leadId;
Salesforce: Invocable Apex methods can be exposed as Agentforce actions via @InvocableMethod / @InvocableVariable.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
11
12.
Bulkification Still Matters in AI ActionsThe action runs on Salesforce. Governor limits and Apex engineering rules still apply.
Avoid
Use
for each Lead
→ query Lead
→ query Tasks
→ calculate
Collect Set<Id>
↓
One Lead query
↓
One aggregate Task query
↓
Build Responses
Problems:
• many SOQL queries
• slower execution
• governor-limit risk
Benefits:
• predictable limits
• reusable pattern
• easier testing
Testing we actually added
Happy path • no open Tasks • missing Lead • missing Lead Id • multiple Leads in one invocation
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
12
13.
Real Problem: The Agent Chose the Wrong SubagentThe first implementation routed “How engaged is Test Zerowko?” to Lead Qualification instead of Lead Research.
SCREENSHOT / LIVE VIEW
Original Trace
→ lead_qualification
Why it happened
What changed
Descriptions overlapped:
Made routing boundaries explicit:
• Lead status / rating / qualification
• General Lead research
• “Engagement” was not explicitly
owned by one route
lead_research → engagement / activity / tasks
lead_qualification → score / level / qualification
details
Insert your real wrong-routing screenshot
Intent → clear subagent boundaries → predictable routing
Salesforce: subagent descriptions and classification/routing are key parts of agent behavior; current Employee/Service agents use HyperClassifier by default in the new builder.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
13
14.
Standard vs Custom: Why Build a Custom Knowledge Search?Salesforce already provides a standard Knowledge search action. The point of the custom version is control, not “custom = better.”
STANDARD — Search Knowledge Articles
CUSTOM — Search Knowledge Base
Salesforce-provided action
Our Apex action
• search text
• language / category filters
• result limit
• standard Knowledge article results
• own input/output contract
• custom filtering rules
• published-only logic
• custom response shape
• custom error / no-result handling
Use this when the standard behavior already meets the requirement.
Use this when the standard capability leaves a real gap.
Developer rule
Standard = less code + less maintenance. Custom = more control + more responsibility.
Salesforce provides a standard Search Knowledge Articles action; custom actions can be built on Apex and other platform capabilities.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
14
15.
How We Keep AI Grounded in Salesforce DataKnowledge Search is a concrete way to control what the agent uses for customer-facing support.
Customer question
Search Knowledge Base
Published article
Answer
Test A — Article found
Test B — No article found
“How do I fix an installation error after setup?”
“How do I configure SSO?”
→ Search action runs
→ Installation Error After Setup found
→ Response can be grounded in the article
→ Search action runs
→ No relevant article
→ Agent should say it found no relevant Knowledge article
→ No invented troubleshooting
Optional screenshot placeholder: Trace showing GROUNDED / no-result behavior
Salesforce grounding / Knowledge capabilities use business data and permissions to provide controlled context to the agent.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
15
16.
Real Problems We Encountered — and What They Taught UsMost difficult issues were integration, context and orchestration problems — not “AI magic.”
Problem
Why
Solution
Wrong subagent
Overlapping routing descriptions
Make intent boundaries explicit
Apex action unavailable
Missing Apex Class Access
Add class to Agent User permission set
Schema errors
Wrong Agentforce data types
Use correct Lightning schema types
Task action blocked
Required inputs missing
Collect inputs + explicit confirmation
Lead AI fields overwritten
Flow trigger too broad
Trigger only on relevant input fields
Customer context missing
Preview lacks real customer/session context
Keep customer restriction; validate in real channel
Pattern
Problem → root cause → targeted fix → reusable lesson
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
16
17.
Security, Reliability and ContextAn agent is only as safe as the permissions, data boundaries and failure handling around it.
Security
Reliability
Context
• Least privilege
• Apex Class Access
• Object / field permissions
• Customer-scoped access
• Do not remove restrictions just to make
Preview work
• Fault paths
• Validate before Send Email
• Required action inputs
• Confirmation for record creation
• Safe no-result behavior
Employee agent → authenticated Salesforce
context
Customer agent → customer / session context
The available context changes what the agent
can safely access.
Developer lesson
When an action fails, first ask: permissions? context? inputs? routing? implementation?
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
17
18.
Developer Mindset: Identify Risks and OpportunitiesNot every idea becomes a feature. The job is to see the problem, assess the impact and choose the right time to act.
Potential risks
Potential opportunities
1. Unsupported / ambiguous input
2. Automation faults
3. Email loops
4. Missing critical data
5. Duplicate processing / idempotency
6. Sensitive or high-risk content
1. Metrics and monitoring
2. Confidence-based routing
3. Human feedback loop
4. Business analytics
5. Scalability / async processing
Important: “identified” does not mean “must implement now.”
Risk now • Improvement later • Architecture to watch
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
18
19.
Build → Test → Trace → Fix → CommitAI development still benefits from a disciplined Salesforce engineering workflow.
1
2
3
4
5
6
7
Build
Preview
Trace
Fix
Unit test
Commit
Git
SCREENSHOT / LIVE VIEW
SCREENSHOT / LIVE VIEW
Agent Builder Trace
VS Code / Git
Insert your final clean trace screenshot
Insert branch or commit screenshot
Salesforce Trace Panel is the built-in reasoning debugger in Builder Preview / Live Test.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
19
20.
Live Demo PlanKeep the live demo short: show one simple retrieval, one AI result, one custom action and one Flow action.
1
Lead lookup
“Find Test Zerowko.”
lead_research → IdentifyRecordByName
2
Qualification
“What is Test Zerowko’s qualification score?”
lead_qualification → Query Records
3
Custom Apex
“How engaged is Test Zerowko?”
lead_research → Get Lead Activity and Open Tasks
4
Task creation
“Create a follow-up task for the at-risk opportunity.”
task_creation → Flow → confirmation
5
Optional Knowledge
“How do I fix an installation error after setup?”
Customer Support Agent Preview → Search Knowledge Base
Demo safety
If a live action is risky or slow, show the Trace screenshot instead. For Customer Support, use Builder Preview (the deployed channel has a known context
limitation).
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
20
21.
FINAL ARCHITECTUREAI Agent = reasoning + context + actions
+ Salesforce engineering
User intent
Agent Router
Subagent
Action → CRM / AI
The practical goal is not “more AI.” It is controlled automation that is understandable, testable,
secure and useful.
Keep standard capabilities where they are sufficient. Build custom logic where it creates real value.
AI SALES ASSISTANT | SALESFORCE
Developer perspective: architecture, trade-offs, risks
21