Skip to content

forcedotcom/sf-skills / plugins/builder/service-engagement/skills/service-email-to-case-configure

service-email-to-case-configure

Verified

Use to configure Salesforce Email-to-Case headlessly via the Metadata API. Reads CaseSettings, applies the emailToCase config with updateMetadata, and verifies by re-reading. Also the entry point for attaching an Agentforce agent to Email-to-Case: configures the E2C base, then delegates agent creation and channel wiring. TRIGGER on set up/configure Email-to-Case, enable E2C routing addresses, add a routing address, or E2C with an Agentforce agent. DO NOT TRIGGER for the interactive Easy Setup wizard, On-Demand E2C only, general Case/web-to-case setup, or an agent with no E2C involved.

scripts/check-agent-email-capability.sh

View on GitHub
#!/usr/bin/env bash
# Preflight: is this org entitled for Agentforce Email-to-Case (the BotEmailDefinition type)?
#
# describeMetadata gates BotEmailDefinition on BOTH orgAccess=orgHasAgentforceServiceAgentEmail
# (the composite ASA-email entitlement) AND API version >= 68. Neither is SOQL-queryable, but a
# read-only metadata describe surfaces the type only when both hold — so this single call subsumes
# the entitlement check and the v68 version gate, and needs no agent to exist yet.
#
# Exit 0  -> org is entitled; safe to delegate agent creation + channel wiring.
# Exit 3  -> type absent (not entitled, or below API v68); caller must STOP before creating an agent.
# Exit !=0/3 -> the org could not be reached/described; treat as inconclusive, not "not entitled".
set -euo pipefail

ORG="${1:?usage: check-agent-email-capability.sh <target-org-alias>}"

# Resolve the org's TRUE max supported API version and pin the describe to it. describeMetadata
# filters types by the request's API version (isInContextVersion), so running below v68 would filter
# BotEmailDefinition out even on an entitled org. Do NOT use `sf org display`'s apiVersion here: that
# is a cached instanceApiVersion that can lag the org's real max (and is not overridden by
# --api-version), so an upgraded-but-not-re-authed org could resolve low and yield a false "not
# entitled". Query /services/data (the live version list) and take the highest.
API=$(sf api request rest --target-org "$ORG" "/services/data" \
  | python3 -c "import sys, json; print(max((v['version'] for v in json.load(sys.stdin)), key=float))")

sf org list metadata-types --target-org "$ORG" --api-version "$API" --json \
  | python3 -c "import sys, json; types = {m['xmlName'] for m in json.load(sys.stdin)['result']['metadataObjects']}; sys.exit(0 if 'BotEmailDefinition' in types else 3)"
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall