Skip to content

forcedotcom/sf-skills / skills/sales-agentforce-pipeline-management-configure

sales-agentforce-pipeline-management-configure

Verified

Use 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).

FileKindSize
SKILL.mdskill md29.0 KB
assets/field-completion-template.genAiPromptTemplate-meta.xmlconfig8.6 KB
assets/pipeline_management_flow.flow-meta.xmlconfig22.9 KB
assets/sales_management_agent.agentother211.7 KB
assets/sales_management_agent.bundle-meta.xmlconfig163 B
assets/sfdx-project.jsonconfig254 B
assets/stage-descriptions/bant.txtmarkdown2.7 KB
assets/stage-descriptions/meddic.txtmarkdown2.9 KB
assets/stage-descriptions/spiced.txtmarkdown2.9 KB
examples/custom-prompt-instructions.mdmarkdown10.0 KB
references/admin-communication.mdmarkdown14.6 KB
references/agent-creation.mdmarkdown22.5 KB
references/auth-and-cli.mdmarkdown6.7 KB
references/automation-matrix.mdmarkdown2.2 KB
references/autonomous-updates.mdmarkdown8.4 KB
references/canonical-agent-path.mdmarkdown6.9 KB
references/data-sources.mdmarkdown6.6 KB
references/field-completion-prompt-template.mdmarkdown6.4 KB
references/field-completion-prompts.mdmarkdown10.4 KB
references/flags.mdmarkdown3.2 KB
references/flow-clone-from-template.mdmarkdown19.5 KB
references/metadata-inventory.mdmarkdown17.1 KB
references/opportunity-stages.mdmarkdown11.9 KB
references/repair-diagnostics.mdmarkdown14.1 KB
references/setup-order.mdmarkdown12.6 KB
references/soap-api-enablement.mdmarkdown21.7 KB
scripts/CHANGES.mdmarkdown5.6 KB
scripts/README.mdmarkdown3.1 KB
scripts/add-field-suggestion.shexecutablescript35.5 KB
scripts/create-agent.shexecutablescript13.2 KB
scripts/create-flow.shexecutablescript8.5 KB
scripts/define-agent-access.shexecutablescript21.2 KB
scripts/deploy-settings.shexecutablescript1.9 KB
scripts/enable-deal-agent.shexecutablescript10.0 KB
scripts/enable-prerequisites.shexecutablescript22.9 KB
scripts/flow-debug-and-verify.shexecutablescript18.4 KB
scripts/retrieve-settings.shexecutablescript5.7 KB
scripts/setup-all.shscript146.6 KB
scripts/shared/agent-bundle-publish.shscript6.7 KB
scripts/shared/agent-detection.shscript9.7 KB
scripts/shared/flow-builder.shscript9.5 KB
scripts/shared/psg.shscript1.9 KB
scripts/shared/soap.shscript5.6 KB
scripts/shared/stage-descriptions.shscript23.3 KB
scripts/shared/test-opp.shscript9.6 KB
scripts/verify-all.shexecutablescript26.0 KB
scripts/verify-prompt-generation.shexecutablescript13.8 KB

scripts/shared/soap.sh

View on GitHub
#!/bin/bash
# Shared library for SOAP Metadata API response parsing
#
# Functions:
#   redact_token <input> - Redacts session IDs and Bearer tokens from error messages
#   parse_soap_response <xml> <field> <http_status> - Classifies SOAP responses
#
# Returns:
#   "true" - field is enabled
#   "false" - field is explicitly disabled or omitted (setting is off)
#   "AUTH_ERROR:<fault>" - authentication/authorization failure
#   "TYPE_UNAVAILABLE:<fault>" - org lacks license/edition for this feature
#   "NETWORK_ERROR" - network/service error (empty response, 5xx, malformed XML)

# Redact session IDs and Bearer tokens from error messages
# Args: $1 = input string
# Returns: string with tokens replaced by [REDACTED]
#
# Salesforce session IDs start with the 15/18-char org id (00D...) followed by
# '!' and a signature segment that contains '.', '=', '-', '+' in addition to
# alphanumerics. Match greedily up to the next whitespace or XML tag boundary
# ('<') so the whole token tail is redacted, not just its leading run.
redact_token() {
  local input="$1"
  printf '%s' "$input" | sed 's/00D[^ <]*/[REDACTED]/g; s/Bearer [^ ]*/Bearer [REDACTED]/g'
}

# Parse SOAP Metadata API response and classify the result
# Args:
#   $1 = raw SOAP XML response
#   $2 = field name to extract (e.g., "enableEinsteinGptPlatform")
#   $3 = HTTP status code (e.g., "200", "503")
# Returns: classification string (see header comments)
parse_soap_response() {
  local xml_response="$1"
  local field_name="$2"
  local http_status="$3"

  # Validate field_name to prevent regex injection in grep patterns below
  if [[ ! "$field_name" =~ ^[A-Za-z0-9_]+$ ]]; then
    echo "NETWORK_ERROR"
    return 0
  fi

  # Disable pipefail locally to allow grep failures without aborting
  local old_opts="$-"
  set +e

  # Check for network/service errors first (non-2xx status or empty response)
  if [[ -z "$xml_response" ]] || [[ "$http_status" != "200" && "$http_status" != "201" ]]; then
    # Restore pipefail before returning
    if [[ "$old_opts" =~ e ]]; then set -e; fi
    echo "NETWORK_ERROR"
    return 0
  fi

  # Check for SOAP Fault (auth, permission, or type errors)
  # Handle both standard and namespace-prefixed faults
  local fault_code=""
  if echo "$xml_response" | grep -q "<soapenv:Fault>\\|<sf:Fault>\\|<Fault>"; then
    # Extract faultcode - try multiple patterns for different namespace conventions
    fault_code=$(echo "$xml_response" | grep -o "<faultcode>[^<]*</faultcode>" | sed 's/<[^>]*>//g' | head -1)
    if [[ -z "$fault_code" ]]; then
      fault_code=$(echo "$xml_response" | grep -o "<sf:faultcode>[^<]*</sf:faultcode>" | sed 's/<[^>]*>//g' | head -1)
    fi
    if [[ -z "$fault_code" ]]; then
      # Handle fully-qualified fault codes like "sf:INVALID_SESSION_ID"
      fault_code=$(echo "$xml_response" | grep -oE "faultcode>[^<]*</.*faultcode" | sed 's/<[^>]*>//g' | sed 's/.*://' | head -1)
    fi

    if [[ -n "$fault_code" ]]; then
      # Extract faultstring for context (will be redacted)
      local fault_string=""
      fault_string=$(echo "$xml_response" | grep -o "<faultstring>[^<]*</faultstring>" | sed 's/<[^>]*>//g' | head -1 || echo "")
      if [[ -z "$fault_string" ]]; then
        fault_string=$(echo "$xml_response" | grep -o "<sf:faultstring>[^<]*</sf:faultstring>" | sed 's/<[^>]*>//g' | head -1 || echo "")
      fi

      # Redact tokens from fault string
      if [[ -n "$fault_string" ]]; then
        fault_string=$(redact_token "$fault_string")
      fi

      # Classify by fault type
      # INVALID_TYPE = org lacks license/edition - distinct from auth failures
      if echo "$fault_code" | grep -qi "INVALID_TYPE"; then
        if [[ "$old_opts" =~ e ]]; then set -e; fi
        echo "TYPE_UNAVAILABLE:${fault_code}${fault_string:+:$fault_string}"
        return 0
      fi

      # All other faults are auth/permission errors
      if [[ "$old_opts" =~ e ]]; then set -e; fi
      echo "AUTH_ERROR:${fault_code}${fault_string:+:$fault_string}"
      return 0
    fi
  fi

  # Check if response is valid XML with the expected structure
  # If it's HTML or malformed XML, treat as network error
  if ! echo "$xml_response" | grep -q "<readMetadataResponse>\\|<updateMetadataResponse>"; then
    if [[ "$old_opts" =~ e ]]; then set -e; fi
    echo "NETWORK_ERROR"
    return 0
  fi

  # Check for closing envelope tag - if missing, XML is truncated
  if ! echo "$xml_response" | grep -q "</soapenv:Envelope>"; then
    if [[ "$old_opts" =~ e ]]; then set -e; fi
    echo "NETWORK_ERROR"
    return 0
  fi

  # Extract field value - try to find <field>true/false</field>
  # head -1 collapses multi-record responses to the first match so two records
  # never produce a two-line value that fails the == comparisons below.
  local field_value=""
  field_value=$(echo "$xml_response" | grep -o "<${field_name}>[^<]*</${field_name}>" | grep -o "true\\|false" | head -1 || echo "")

  if [[ "$field_value" == "true" ]]; then
    if [[ "$old_opts" =~ e ]]; then set -e; fi
    echo "true"
    return 0
  fi

  # If field is explicitly false OR field is omitted entirely, treat as disabled.
  # Salesforce omits boolean settings fields when they're off rather than
  # emitting <field>false</field>, so an absent field inside an otherwise valid
  # readMetadataResponse is the disabled state, not an error.
  if [[ "$field_value" == "false" ]] || [[ -z "$field_value" ]]; then
    if [[ "$old_opts" =~ e ]]; then set -e; fi
    echo "false"
    return 0
  fi

  # Shouldn't reach here, but if we do, treat as network error (unexpected response format)
  if [[ "$old_opts" =~ e ]]; then set -e; fi
  echo "NETWORK_ERROR"
  return 0
}
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: 472kUpdated Claude CodeCodexVerifiedInstall
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: 472kUpdated Claude CodeCodexVerifiedInstall
rea-tool-designmorluto/reaAudit, investigate, design, or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
ponytail-auditDietrichGebert/ponytailQuality audit of the whole repo: bugs, security, real load, missing tests, speed, and what to delete. Most important first.Stars: 194kUpdated Claude CodeCodexVerifiedInstall