forcedotcom/sf-skills / skills/sales-agentforce-pipeline-management-configure
sales-agentforce-pipeline-management-configure
VerifiedUse to configure, set up, or repair the Sales Management agent and Agentforce Pipeline Management in a Salesforce org. Automates metadata creation for flows, prompt templates, permission sets, and data source configuration. TRIGGER when: user wants to enable Pipeline Management, configure Sales pipeline features, set up the Sales Management agent for opportunity field updates (including autonomous updates), connect enabled data sources like Einstein Conversation Insights or Einstein Activity Capture, customize opportunity stage descriptions, configure post-meeting suggestions, verify or audit configuration status, fix partially configured orgs, or troubleshoot Pipeline Management metadata issues. DO NOT TRIGGER when: user wants to build a custom agent (use agentforce-generate), configure general Agentforce tracing (use platform-tracing-agentforce-configure), work with non-Sales agents, or enable Einstein Conversation Insights or Einstein Activity Capture from scratch (provisioning is out of scope).
scripts/enable-deal-agent.sh
View on GitHub#!/bin/bash
# Enable Pipeline Management (SalesDealAgentSettings) via SOAP API
# Usage: ./enable-deal-agent.sh <org-alias>
set -euo pipefail
# sf CLI can emit ANSI color codes inside --json stdout, breaking jq parsing.
# 2>/dev/null only strips stderr; these env vars are the reliable fix (see PM notes).
export NO_COLOR=1
export FORCE_COLOR=0
ORG_ALIAS="${1:-}"
if [[ -z "$ORG_ALIAS" ]]; then
echo "â Error: Missing org alias"
echo "Usage: $0 <org-alias>"
exit 1
fi
echo "đ Enabling Pipeline Management for org: $ORG_ALIAS"
echo ""
# Get org details
ORG_INFO=$(sf org display --target-org "$ORG_ALIAS" --json 2>/dev/null)
ORG_ID=$(echo "$ORG_INFO" | jq -r '.result.id')
INSTANCE_URL=$(echo "$ORG_INFO" | jq -r '.result.instanceUrl')
ACCESS_TOKEN=$(echo "$ORG_INFO" | jq -r '.result.accessToken')
# Newer CLI versions redact accessToken â use show-access-token fallback
if [[ -z "$ACCESS_TOKEN" || "$ACCESS_TOKEN" == "null" || "$ACCESS_TOKEN" == *"REDACTED"* ]]; then
ACCESS_TOKEN=$(echo "y" | sf org auth show-access-token --target-org "$ORG_ALIAS" --no-prompt --json 2>/dev/null | jq -r '.result.accessToken // empty')
fi
if [[ -z "$ORG_ID" || -z "$INSTANCE_URL" || -z "$ACCESS_TOKEN" || "$ACCESS_TOKEN" == "null" ]]; then
echo "Error: Could not retrieve org details. Is the org authenticated?"
exit 1
fi
echo "Org ID: $ORG_ID"
echo "Instance URL: $INSTANCE_URL"
echo ""
# Pre-flight checks
echo "đ Running pre-flight checks..."
echo ""
PREFLIGHT_FAILED=false
# Check Einstein GPT is enabled (critical) â via SOAP readMetadata
GENAI_CHECK=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>EinsteinGptSettings</met:type><met:fullNames>EinsteinGpt</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null | grep -o "<enableEinsteinGptPlatform>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$GENAI_CHECK" == "true" ]]; then
echo " â
Einstein GPT enabled"
else
echo " â Einstein GPT NOT enabled (required)"
PREFLIGHT_FAILED=true
fi
# Check Agentforce Agent is enabled (required) â via SOAP readMetadata
COPILOT_CHECK=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>EinsteinCopilotSettings</met:type><met:fullNames>EinsteinCopilot</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null | grep -o "<enableEinsteinGptCopilot>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$COPILOT_CHECK" == "true" ]]; then
echo " â
Agentforce Agent enabled"
else
echo " â Agentforce Agent NOT enabled (required)"
PREFLIGHT_FAILED=true
fi
# Check Agentforce Studio / Agent Platform is enabled (required) â via SOAP readMetadata.
# AgentPlatformSettings.enableAgentPlatform (OrgPreference AgentPlatformEnabled) gates
# SalesDealAgentSettings: core's DealAgentEnabledOrgPreference validates the Agentforce
# Platform preference and rejects Deal Agent enablement if it is off, so this must pass
# before we attempt the SalesDealAgent update below.
AGENT_PLATFORM_CHECK=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>AgentPlatformSettings</met:type><met:fullNames>AgentPlatform</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null | grep -o "<enableAgentPlatform>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$AGENT_PLATFORM_CHECK" == "true" ]]; then
echo " â
Agentforce Studio (Agent Platform) enabled"
else
echo " â Agentforce Studio (Agent Platform) NOT enabled (required â gates Deal Agent)"
PREFLIGHT_FAILED=true
fi
# Check Enhanced Notes (required dependency) â via SOAP readMetadata
NOTES_CHECK=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>EnhancedNotesSettings</met:type><met:fullNames>EnhancedNotes</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null | grep -o "<enableEnhancedNotes>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$NOTES_CHECK" == "true" ]]; then
echo " â
Enhanced Notes enabled"
else
echo " â Enhanced Notes NOT enabled (required)"
PREFLIGHT_FAILED=true
fi
# Check org edition compatibility
ORG_EDITION=$(sf data query --query "SELECT OrganizationType FROM Organization" --target-org "$ORG_ALIAS" --json 2>/dev/null | jq -r '.result.records[0].OrganizationType')
echo " âšī¸ Org Edition: $ORG_EDITION"
if [[ "$ORG_EDITION" == "Developer Edition" ]]; then
echo " â ī¸ Warning: Pipeline Management may have limited functionality in Developer Edition"
fi
echo ""
if [[ "$PREFLIGHT_FAILED" == "true" ]]; then
echo "â Pre-flight checks failed. Run ./enable-prerequisites.sh first."
exit 1
fi
echo "â
Pre-flight checks passed"
echo ""
# Check if already enabled (via SOAP readMetadata â SalesDealAgentSettings is NOT queryable via SOQL)
echo -n "Checking current SalesDealAgent status... "
CURRENT_STATUS=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>SalesDealAgentSettings</met:type><met:fullNames>SalesDealAgent</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null | grep -o "<enableDealAgent>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$CURRENT_STATUS" == "true" ]]; then
echo "â
(already enabled)"
echo ""
echo "â
Pipeline Management is already enabled"
exit 0
fi
echo "âŗ (not enabled)"
echo ""
# Enable via SOAP API v64.0
echo "Enabling Pipeline Management via SOAP API v64.0..."
echo ""
SOAP_REQUEST=$(cat <<'EOF'
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:met="http://soap.sforce.com/2006/04/metadata">
<soapenv:Header>
<met:SessionHeader>
<met:sessionId>{{ACCESS_TOKEN}}</met:sessionId>
</met:SessionHeader>
</soapenv:Header>
<soapenv:Body>
<met:updateMetadata>
<met:metadata xsi:type="met:SalesDealAgentSettings" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<met:fullName>SalesDealAgent</met:fullName>
<met:enableDealAgent>true</met:enableDealAgent>
<met:enableDealAgentAutoApproveAllTasks>false</met:enableDealAgentAutoApproveAllTasks>
</met:metadata>
</met:updateMetadata>
</soapenv:Body>
</soapenv:Envelope>
EOF
)
# Substitute access token
SOAP_REQUEST="${SOAP_REQUEST//\{\{ACCESS_TOKEN\}\}/$ACCESS_TOKEN}"
# Send SOAP request
RESPONSE=$(curl -s -X POST "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=utf-8" \
-H "SOAPAction: update" \
-d "$SOAP_REQUEST")
# Check response
if echo "$RESPONSE" | grep -q "<success>true</success>"; then
echo "â
SOAP API call succeeded"
else
echo "â SOAP API call failed"
echo ""
echo "Response:"
echo "$RESPONSE"
exit 1
fi
echo ""
# Verify enablement (via SOAP readMetadata)
echo "đ Verifying Pipeline Management is enabled..."
sleep 2 # Brief wait for propagation
VERIFY_RESULT=$(curl -s "${INSTANCE_URL}/services/Soap/m/64.0" \
-H "Content-Type: text/xml; charset=UTF-8" \
-H "SOAPAction: readMetadata" \
-d "<?xml version='1.0' encoding='utf-8'?>
<soapenv:Envelope xmlns:soapenv='http://schemas.xmlsoap.org/soap/envelope/' xmlns:met='http://soap.sforce.com/2006/04/metadata'>
<soapenv:Header><met:SessionHeader><met:sessionId>${ACCESS_TOKEN}</met:sessionId></met:SessionHeader></soapenv:Header>
<soapenv:Body><met:readMetadata><met:type>SalesDealAgentSettings</met:type><met:fullNames>SalesDealAgent</met:fullNames></met:readMetadata></soapenv:Body>
</soapenv:Envelope>" 2>/dev/null)
VERIFY_DEAL_AGENT=$(echo "$VERIFY_RESULT" | grep -o "<enableDealAgent>[^<]*" | grep -o "true\|false" || echo "")
if [[ "$VERIFY_DEAL_AGENT" == "true" ]]; then
echo " â
enableDealAgent: true"
AUTO_APPROVE=$(echo "$VERIFY_RESULT" | grep -o "<enableDealAgentAutoApproveAllTasks>[^<]*" | grep -o "true\|false" || echo "false")
echo " âšī¸ enableDealAgentAutoApproveAllTasks: $AUTO_APPROVE (default: false)"
echo ""
echo "â
Pipeline Management enabled successfully"
echo ""
echo "Next steps:"
echo " 1. Run ./create-flow.sh $ORG_ALIAS to create the suggestion processing flow"
echo " 2. Run ./create-agent.sh $ORG_ALIAS <bundle-path> to create and activate the agent"
else
echo " â Verification failed"
echo ""
echo "Query result:"
echo "$VERIFY_RESULT"
exit 1
fi
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| rea-analysis-optimizationmorluto/reaOptimize REA providers and shared analysis workflows for agent context, latency, CPU, and memory while preserving correctness and Evidence. Use for analysis bottlenecks and cache or query design; CI/test-suite optimization belongs to rea-ci-tests-audit. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-ci-tests-auditmorluto/reaAudit REA CI and test suites for correctness, fixture drift, false passes, and measured performance; use for suite or workflow investigations and efficiency changes, rather than ordinary feature testing or a single test failure. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics. | Stars: 472k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |