Skip to content

Commit 63da57c

Browse files
author
Sim Pi Agent
committed
Pi Babysit: address PR #8804 feedback
1 parent c51c6ca commit 63da57c

1 file changed

Lines changed: 18 additions & 25 deletions

File tree

  • apps/sim/content/library/salesforce-ai-agent-lead-scoring-workflow

‎apps/sim/content/library/salesforce-ai-agent-lead-scoring-workflow/index.mdx‎

Lines changed: 18 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,41 +6,41 @@ date: 2026-10-08
66
updated: 2026-10-08
77
authors:
88
- andrew
9-
readingTime: 12
9+
readingTime: 13
1010
tags: [AI Agents, Salesforce, Lead Scoring, CRM Automation, Sim]
1111
ogImage: /library/salesforce-ai-agent-lead-scoring-workflow/cover.jpg
1212
draft: false
1313
faq:
1414
- q: "How do I build a Salesforce AI agent for lead scoring?"
15-
a: "Sim builds a Salesforce AI lead-scoring agent by retrieving eligible leads, extracting structured evidence, calculating a deterministic score, routing required approvals, and writing approved results back to Salesforce."
15+
a: "Sim builds a Salesforce AI lead-scoring agent by retrieving eligible leads, extracting structured evidence, calculating a deterministic score, routing required approvals, and applying only the Salesforce updates supported by the configured write path."
1616
- q: "Can Sim connect to Salesforce?"
1717
a: "Sim connects to Salesforce through its documented native Salesforce integration and an authorized Salesforce credential."
1818
- q: "Does Sim provide a Salesforce MCP server?"
1919
a: "Sim should not be described as providing a Salesforce-hosted MCP server; this implementation uses Sim’s native Salesforce integration, while Salesforce separately documents its own hosted MCP capability."
2020
- q: "What is a Salesforce MCP server?"
2121
a: "A Salesforce MCP server is a Salesforce-provided Model Context Protocol endpoint that exposes supported Salesforce capabilities to compatible MCP clients under Salesforce’s documented authentication and permission model."
2222
- q: "Do I need a Salesforce MCP server to automate lead scoring?"
23-
a: "Sim does not need a Salesforce MCP server for the workflow in this guide because its native Salesforce integration handles the required retrieval and write-back steps."
23+
a: "Sim does not need a Salesforce MCP server for the workflow in this guide because its native Salesforce integration handles retrieval, supported standard-field Lead updates, and Task creation."
2424
- q: "How should an AI agent score Salesforce leads?"
2525
a: "Sim should score Salesforce leads with a fixed rubric, constrained evidence extraction, deterministic arithmetic, explicit thresholds, and documented handling for missing data."
2626
- q: "Should the AI model calculate the final lead score?"
2727
a: "Sim should use the model to normalize evidence and use deterministic workflow logic to calculate the final Salesforce lead score."
2828
- q: "Can Sim update Salesforce Lead records?"
29-
a: "Sim can use its documented Salesforce integration to update approved Lead fields by Salesforce record ID."
29+
a: "Sim can use its documented Salesforce integration to update the standard Lead fields exposed by its Update Lead action by Salesforce record ID; that action does not accept arbitrary custom fields."
3030
- q: "Can Sim create Salesforce follow-up tasks?"
3131
a: "Sim can use its documented Salesforce integration to create a Salesforce Task after the workflow’s routing and approval requirements pass."
3232
- q: "How do I add human approval before a Salesforce update?"
3333
a: "Sim adds human approval with a Human in the Loop block followed by a Condition that checks the submitted approval field before routing to Salesforce write actions."
3434
- q: "Does Sim’s Human in the Loop block automatically approve or reject a change?"
3535
a: "Sim’s Human in the Loop block pauses and resumes the run with form data, but a downstream Condition must evaluate the approval field to approve or reject the Salesforce change."
3636
- q: "What Salesforce permissions should the integration user have?"
37-
a: "Salesforce should grant Sim’s dedicated integration user only the object, field, record, and action permissions required to read scoring inputs, update approved score fields, and create permitted tasks."
37+
a: "Salesforce should grant Sim’s dedicated integration user only the object, field, record, and action permissions required to read scoring inputs, update supported approved fields, and create permitted tasks."
3838
- q: "Can I test a Sim Salesforce workflow in a sandbox?"
3939
a: "Sim should be connected to a Salesforce sandbox or tightly controlled test cohort before production write actions are enabled."
4040
- q: "How do I prevent duplicate Salesforce tasks?"
4141
a: "Sim should query for an existing matching open task or use another approved idempotency key before creating a Salesforce follow-up task."
4242
- q: "How do I prevent AI from overwriting Salesforce data incorrectly?"
43-
a: "Sim should constrain model output, calculate scores deterministically, update only dedicated fields, require approval where appropriate, and verify the Salesforce record after each write."
43+
a: "Sim should constrain model output, calculate scores deterministically, update only fields supported by the configured write path, require approval where appropriate, and verify the Salesforce record after each write."
4444
- q: "What happens when Salesforce data is missing?"
4545
a: "Sim should record the Salesforce input as missing, award zero points unless the rubric says otherwise, and route consequential ambiguity for human review rather than inventing evidence."
4646
- q: "What happens when a reviewer rejects the proposed score?"
@@ -69,7 +69,7 @@ faq:
6969

7070
## TL;DR
7171

72-
**Sim can retrieve Salesforce leads, evaluate them against an explicit scoring rubric, pause high-impact changes for human approval, and write approved scores and follow-up tasks back to Salesforce.**
72+
**Sim can retrieve Salesforce leads, evaluate them against an explicit scoring rubric, pause high-impact changes for human approval, and create approved follow-up tasks or supported standard-field updates in Salesforce.**
7373

7474
The reliable pattern is to let an AI model interpret messy evidence while deterministic workflow logic assigns points, applies thresholds, and controls Salesforce writes. This separation makes the workflow easier to test, explain, and govern than asking a model to invent a score in one step.
7575

@@ -85,7 +85,7 @@ A production workflow should divide the job into five responsibilities:
8585
2. Sim orchestrates retrieval, AI analysis, deterministic scoring, approval, and write-back.
8686
3. The model normalizes ambiguous text into constrained evidence, not an unrestricted final score.
8787
4. Deterministic logic calculates the score and tier from an approved rubric.
88-
5. A reviewer approves consequential updates before Sim changes Salesforce or creates a sales task.
88+
5. A reviewer approves consequential updates before Sim changes a supported Salesforce field or creates a sales task.
8989

9090
For broader product rankings, see [Best AI Agents for Sales and CRM Automation](https://www.sim.ai/library/best-ai-agents-sales-crm-automation). This guide focuses specifically on implementing and validating one Salesforce lead-scoring workflow.
9191

@@ -101,7 +101,7 @@ A useful workflow contract is:
101101
| Normalize | Approved CRM fields and related signals | Structured evidence with source fields | Mark missing evidence instead of guessing |
102102
| Score | Structured evidence and fixed rubric | Numeric score and criterion-level breakdown | Reject totals outside 0–100 |
103103
| Route | Score, tier, confidence, and policy flags | Auto-close, review, or approved-write path | Send ambiguous or sensitive cases to review |
104-
| Write | Approved score package | Updated Lead fields and, when needed, a Task | Record the error and avoid partial duplicate writes |
104+
| Write | Approved score package | Supported standard Lead fields and, when needed, a Task | Record the error and avoid partial duplicate writes |
105105
| Verify | Expected and actual Salesforce values | Pass or exception | Escalate mismatches without silently retrying writes |
106106

107107
The workflow should preserve the Salesforce Lead ID throughout the run. That ID is the safest key for updates and task relationships; names and email addresses are not stable identifiers.
@@ -229,38 +229,31 @@ The review form should display:
229229
- Criterion-level point breakdown.
230230
- Evidence summary and missing inputs.
231231
- Proposed Salesforce fields to change.
232-
- Proposed task owner, subject, and due date.
232+
- Proposed task subject and due date.
233233
- Approve or reject field.
234234
- Required reviewer note for overrides or rejections.
235235

236-
A practical policy is to require review when the score is high, the model reports missing or conflicting evidence, an owner would change, or the workflow would create a seller task. Lower-risk updates can follow a separately approved policy, but the workflow should never interpret the Human in the Loop block’s mere completion as approval.
236+
A practical policy is to require review when the score is high, the model reports missing or conflicting evidence, or the workflow would create a seller task. Lower-risk updates can follow a separately approved policy, but the workflow should never interpret the Human in the Loop block’s mere completion as approval.
237237

238238
For a broader explanation of approval patterns, see [What Is Human-in-the-Loop in AI Agents?](https://www.sim.ai/library/what-is-human-in-the-loop-in-ai-agents).
239239

240240
## How do I write lead scores and follow-up tasks back to Salesforce?
241241

242242
**Sim should update only approved Salesforce fields and create a follow-up Task only when the routing policy requires one.**
243243

244-
Create dedicated custom fields instead of overwriting unrelated standard fields. Example destination fields are:
244+
Sim’s native Update Lead action accepts the Lead ID and a fixed set of standard fields, including Status, Lead Source, Title, and Description. It does not accept arbitrary custom fields. Creating fields such as `AI_Lead_Score__c` in Salesforce therefore does not make them writable through this action.
245245

246-
- `AI_Lead_Score__c`
247-
- `AI_Lead_Tier__c`
248-
- `AI_Score_Reason__c`
249-
- `AI_Scored_At__c`
250-
- `AI_Scoring_Version__c`
251-
252-
These are examples, not universal Salesforce fields; an administrator must create or map the actual fields used by the organization.
253-
254-
Use the documented Salesforce update action in Sim to update the Lead by ID. Write the numeric score, tier, concise reason, scoring timestamp, and rubric or workflow version together so later audits can identify the policy that produced the result.
246+
Keep custom-score persistence disabled unless the organization implements and validates a separate Salesforce API or Salesforce-side automation path for those fields. With the native actions alone, retain the score, tier, criterion breakdown, timestamp, and rubric version in the workflow’s execution evidence; update a supported standard Lead field only when the approved policy genuinely calls for it; and create the follow-up Task after approval. Do not overwrite an unrelated standard field merely to store a score.
255247

256248
For an approved high-priority lead, use the [documented Salesforce create action](https://docs.sim.ai/integrations/salesforce) to create a Task. A typical mapping includes:
257249

258250
- `WhoId`: the Salesforce Lead ID.
259251
- `Subject`: a stable description such as “Review high-priority AI-scored lead.”
260-
- `OwnerId`: an approved user or queue assignment resolved by policy.
261252
- `ActivityDate`: the approved due date.
262253
- `Description`: the evidence summary and score breakdown, excluding unnecessary sensitive data.
263254

255+
The native Create Task action does not expose `OwnerId`. The task therefore cannot be assigned to a chosen user or queue from that action; if explicit assignment is required, route it through separately validated Salesforce-side automation after creation.
256+
264257
Add an idempotency check before task creation. For example, query for an open task carrying the same lead ID, workflow version, and purpose; if one exists, update or skip it according to policy instead of creating a duplicate.
265258

266259
## How do I verify a Salesforce lead-scoring workflow?
@@ -274,9 +267,9 @@ Build a test matrix that covers:
274267
| All ten criteria pass | Score 100; high tier; approval path |
275268
| No criteria pass | Score 0; low tier; no sales task |
276269
| Score equals 75 | High tier; boundary handled correctly |
277-
| Score equals 74 | Medium tier; boundary handled correctly |
270+
| Score equals 70 | Medium tier; highest reachable score below 75 |
278271
| Score equals 50 | Medium tier; boundary handled correctly |
279-
| Score equals 49 | Low tier; boundary handled correctly |
272+
| Score equals 45 | Low tier; highest reachable score below 50 |
280273
| Missing optional signal | Zero points for that criterion; missing input recorded |
281274
| Invalid structured model output | No Salesforce write; exception path |
282275
| Reviewer rejects | No Lead update and no Task creation |
@@ -318,7 +311,7 @@ Use this deployment checklist:
318311

319312
## Do you need a Salesforce MCP server to build this workflow?
320313

321-
**Sim does not require a Salesforce MCP server for this implementation because Sim’s native Salesforce integration can perform the documented retrieval and write-back steps.**
314+
**Sim does not require a Salesforce MCP server for this implementation because Sim’s native Salesforce integration can perform retrieval, supported standard-field updates, and Task creation.**
322315

323316
MCP is useful when a team specifically wants to expose tools through the Model Context Protocol or standardize tool access across compatible clients. Salesforce documents [hosted MCP servers](https://developer.salesforce.com/docs/platform/hosted-mcp-servers/guide/hosted-mcp-servers-overview.html), but that Salesforce capability should not be confused with Sim’s native Salesforce integration or treated as proof that Sim supplies a Salesforce-hosted MCP server.
324317

0 commit comments

Comments
 (0)