sales-engagement-api
Use when enrolling records in Sales Engagement cadences from Apex, logging call outcomes on cadence steps, customizing cadence step actions via Apex, or consuming cadence lifecycle events through Change Data Capture. Triggers: 'enroll lead in cadence', 'assignTargetToSalesCadence', 'ActionCadenceTracker', 'log call result cadence', 'Sales Engagement Apex'. NOT for building or administering cadence structures (steps, branches, variants) — cadence content must be authored in the Cadence Builder UI and cannot be created or mutated via API.
Best use case
sales-engagement-api is best used when you need a repeatable AI agent workflow instead of a one-off prompt.
Use when enrolling records in Sales Engagement cadences from Apex, logging call outcomes on cadence steps, customizing cadence step actions via Apex, or consuming cadence lifecycle events through Change Data Capture. Triggers: 'enroll lead in cadence', 'assignTargetToSalesCadence', 'ActionCadenceTracker', 'log call result cadence', 'Sales Engagement Apex'. NOT for building or administering cadence structures (steps, branches, variants) — cadence content must be authored in the Cadence Builder UI and cannot be created or mutated via API.
Teams using sales-engagement-api should expect a more consistent output, faster repeated execution, less prompt rewriting.
When to use this skill
- You want a reusable workflow that can be run more than once with consistent structure.
When not to use this skill
- You only need a quick one-off answer and do not need a reusable workflow.
- You cannot install or maintain the underlying files, dependencies, or repository context.
Installation
Claude Code / Cursor / Codex
Manual Installation
- Download SKILL.md from GitHub
- Place it in
.claude/skills/sales-engagement-api/SKILL.mdinside your project - Restart your AI agent — it will auto-discover the skill
How sales-engagement-api Compares
| Feature / Agent | sales-engagement-api | Standard Approach |
|---|---|---|
| Platform Support | Not specified | Limited / Varies |
| Context Awareness | High | Baseline |
| Installation Complexity | Unknown | N/A |
Frequently Asked Questions
What does this skill do?
Use when enrolling records in Sales Engagement cadences from Apex, logging call outcomes on cadence steps, customizing cadence step actions via Apex, or consuming cadence lifecycle events through Change Data Capture. Triggers: 'enroll lead in cadence', 'assignTargetToSalesCadence', 'ActionCadenceTracker', 'log call result cadence', 'Sales Engagement Apex'. NOT for building or administering cadence structures (steps, branches, variants) — cadence content must be authored in the Cadence Builder UI and cannot be created or mutated via API.
Where can I find the source code?
You can find the source code on GitHub using the link provided at the top of the page.
SKILL.md Source
# Sales Engagement API Use this skill when programmatic Apex code needs to enroll records in Sales Engagement cadences, react to cadence lifecycle events, or log outcomes on cadence steps. The objective is reliable, bulkified enrollment that respects the platform's invocable action model and leverages Change Data Capture for event-driven reactions rather than unsupported triggers. --- ## Before Starting - Confirm the org has an active Sales Engagement (formerly High Velocity Sales) license and that the Sales Engagement feature is enabled in Setup. - Identify the target object type — enrollment supports Lead, Contact, and Person Account. Standard Account and custom objects are not supported targets for `assignTargetToSalesCadence` as of Spring '25. - Determine whether the cadence already exists in the Cadence Builder UI. The cadence structure (steps, branches, email templates, call scripts) is entirely read-only via API. Apex cannot create or modify cadence content — that belongs in the UI. - Clarify if the requirement is enrollment only, step-completion logging, real-time reaction to cadence state changes, or all three. - Understand volume expectations. Invocable actions called from Apex count against DML and governor limits. Bulk enrollment via the action supports a list of inputs, which is critical for batch contexts. --- ## Core Concepts ### The `assignTargetToSalesCadence` Invocable Action Is the Only Enrollment API Salesforce does not expose a direct DML-based way to create enrollment records. Cadence enrollment is performed by calling the `assignTargetToSalesCadence` invocable action using `Invocable.Action` in Apex or by invoking it from Flow. Attempting to insert `ActionCadenceTracker` or related objects directly via DML will result in errors. This pattern is intentional: the platform enforces enrollment rules (duplicate prevention, license checks, step scheduling) inside the action rather than exposing them to raw DML. ### The ActionCadence Object Family Is Read-Only via Apex DML The `ActionCadence`, `ActionCadenceStep`, `ActionCadenceStepVariant`, and `ActionCadenceTracker` objects represent the cadence structure and enrollment state. They can be queried via SOQL, but DML mutations are restricted or unsupported except through the designated invocable actions. Do not attempt to `insert` or `update` these objects directly. The only mutation surface for enrollment is the invocable action; for step completion and call logging it is the designated `completeActionCadenceStep` action or task record updates. ### Triggers Are Not Supported on ActionCadence Objects — Use CDC Standard Apex triggers cannot be placed on `ActionCadenceTracker`, `ActionCadenceStepTracker`, or related objects. Reacting to cadence state changes requires Change Data Capture (CDC). Enable CDC on the `ActionCadenceTracker` object in Setup, then author an Async Apex Trigger on the `ActionCadenceTrackerChangeEvent` channel. This is the officially supported pattern for event-driven reactions to enrollment lifecycle changes. ### Enrollment Respects Duplicate Guards at the Platform Level The invocable action enforces that a target cannot be enrolled in the same cadence twice if an active enrollment already exists. The action returns output fields indicating success or failure. Production code must inspect these outputs per invocation. Swallowing action errors silently leaves the calling code unable to distinguish successful enrollments from duplicates or license errors. --- ## Common Patterns ### Bulk Cadence Enrollment Service **When to use:** A batch process, trigger, or scheduled job needs to enroll many Leads or Contacts into a cadence at once. **How it works:** Collect `Invocable.Action.Input` instances for each target, set the `sObjectName`, `targetId`, `cadenceName`, and `userId` parameters, then invoke the `assignTargetToSalesCadence` action as a bulk list. Inspect each `Invocable.Action.Result` for success and log or surface failures per record. **Why not the alternative:** Calling the action one record at a time in a loop inflates Apex CPU time and may exceed governor limits on large sets. The list-based invocation is the bulk-safe pattern. ### CDC-Based Async Trigger for Enrollment Lifecycle Events **When to use:** Downstream processes need to react when a target is enrolled, a step is completed, or a cadence run ends. **How it works:** Enable `ActionCadenceTracker` CDC in Setup. Implement an Async Apex Trigger on `ActionCadenceTrackerChangeEvent`. Inside the trigger, read `EventBus.TriggerContext.currentResumeCheckpoint()` and process the `ChangeEventHeader` to determine the change type (`CREATE`, `UPDATE`, `DELETE`). Enqueue a Queueable for heavier work. **Why not the alternative:** A synchronous Apex trigger on `ActionCadenceTracker` is not supported. Polling SOQL for state changes is fragile and wastes queries. ### Step Completion and Call Logging **When to use:** A CTI integration or custom UI needs to record the outcome of a call step and advance the cadence. **How it works:** Use the `completeActionCadenceStep` invocable action, passing the `ActionCadenceStepTrackerId` and outcome fields (call result, disposition). This advances the tracker to the next step. Alternatively, update the associated `Task` record's call result fields; the cadence engine reads those fields to determine step completion in call-step contexts. **Why not the alternative:** Directly updating `ActionCadenceStepTracker` status fields via DML is not supported and will fail silently or throw errors. --- ## Decision Guidance | Situation | Recommended Approach | Reason | |---|---|---| | Enroll leads from a batch job or trigger | `assignTargetToSalesCadence` invocable action, bulk list input | Only supported enrollment surface; list input keeps limits safe | | React to enrollment or step completion | CDC on `ActionCadenceTrackerChangeEvent` + Async Apex Trigger | Triggers not supported on ActionCadence objects | | Log call disposition on a cadence step | `completeActionCadenceStep` invocable action or Task update | DML on step tracker is not supported | | Build or modify cadence structure via API | Not possible — redirect to Cadence Builder UI | Cadence content is read-only via API by design | | Check whether a target is already enrolled | SOQL on `ActionCadenceTracker` where `State = 'Active'` | Query is supported; use to guard against duplicate enrollment attempts | --- ## Recommended Workflow Step-by-step instructions for an AI agent or practitioner activating this skill: 1. Confirm prerequisites — verify that the Sales Engagement license is active, the target cadence exists in the UI, and the target object type is Lead, Contact, or Person Account. 2. Query existing enrollment state — SOQL `ActionCadenceTracker` for active enrollments on the target records to prevent duplicate action calls and interpret likely results. 3. Build the enrollment service — implement a service class that constructs `Invocable.Action.Input` lists, calls `assignTargetToSalesCadence` in bulk, and inspects `Invocable.Action.Result` per record to capture errors. 4. Handle CDC for lifecycle reactions — if downstream automation is needed, enable CDC on `ActionCadenceTracker`, scaffold an Async Apex Trigger on `ActionCadenceTrackerChangeEvent`, and move heavy work to Queueable. 5. Implement step completion logging — if call results must be logged programmatically, use the `completeActionCadenceStep` invocable action or update the Task record associated with the step. 6. Test in a scratch org or sandbox with Sales Engagement enabled — confirm invocable action outputs, governor limit consumption, and CDC event delivery under bulk load. 7. Run the skill checker and validate the full package before committing. --- ## Review Checklist - [ ] Enrollment is performed via `assignTargetToSalesCadence` invocable action, not DML on ActionCadence objects. - [ ] Invocable action results are inspected per record and failures are surfaced or logged. - [ ] A duplicate enrollment guard queries `ActionCadenceTracker` for active enrollments before calling the action. - [ ] CDC is used for lifecycle reactions, not Apex triggers on ActionCadence objects. - [ ] Step completion uses `completeActionCadenceStep` or Task field updates — not direct DML on `ActionCadenceStepTracker`. - [ ] All action calls use list inputs to stay bulkification-safe. - [ ] Tests use `@isTest` stubs or mock invocable action results since the action cannot fire in test contexts without the managed package. --- ## Salesforce-Specific Gotchas 1. **Invocable actions do not run in unit tests without the Sales Engagement package context** — tests that call `assignTargetToSalesCadence` via `Invocable.Action.invoke()` will return empty results or throw in a standard scratch org without the SE license provisioned. Use a wrapper interface to allow mocking in test context. 2. **ActionCadenceTracker CDC events can arrive out of order** — Async Apex Triggers process events in the order they are delivered by the event bus, which may not match the business order of step completions. Designs that require strict ordering must use the `ChangeEventHeader` sequence or query the tracker state rather than relying on event order. 3. **`assignTargetToSalesCadence` silently no-ops if the target is already in an active enrollment** — the action returns a result with `success = false` and an error code rather than throwing an exception. Callers that only check for exceptions will not detect duplicate enrollment failures. 4. **Cadence structure objects (`ActionCadence`, `ActionCadenceStep`) are accessible via SOQL but reflect the live state** — they do not represent a versioned snapshot. A cadence modified in the UI mid-run changes the SOQL results. --- ## Output Artifacts | Artifact | Description | |---|---| | Enrollment service class | Apex service wrapping `assignTargetToSalesCadence` with bulk input construction and result inspection | | Async Apex Trigger scaffold | CDC-based trigger on `ActionCadenceTrackerChangeEvent` with Queueable handoff | | Duplicate guard SOQL | Query to detect active `ActionCadenceTracker` records before enrollment | | Enrollment review findings | Assessment of DML patterns, result handling gaps, and CDC configuration state | --- ## Related Skills - `apex/change-data-capture-apex` — use for deep CDC pattern design including resume checkpoints, chunking, and replay gaps when the CDC trigger is more complex than a thin enqueue. - `apex/invocable-methods` — use when building or calling invocable actions for advanced input/output type design. - `apex/async-apex` — use when the Queueable work spawned from the CDC trigger requires chaining, retry, or batch fallback patterns. - `apex/governor-limits` — use when enrollment volume is high enough that invocable action call counts and DML governor consumption need modeling.
Related Skills
salesforce-shield-deployment
Roll out Shield (Platform Encryption + Event Monitoring + Field Audit Trail) end-to-end, sequencing feature enablement to avoid data lockout. NOT for Classic Encryption or general PE design.
ferpa-compliance-in-salesforce
Use this skill when implementing FERPA (Family Educational Rights and Privacy Act) compliance controls in Salesforce Education Cloud or Education Data Architecture (EDA): LearnerProfile FERPA boolean fields, directory information opt-out via FLS and Individual data privacy flags, ContactPointTypeConsent for parental and third-party disclosure, 45-day student records response window tracking, and consent workflow automation. Trigger keywords: FERPA, student records privacy, LearnerProfile, parental disclosure, directory information opt-out, education data privacy, student consent, education cloud compliance. NOT for GDPR/CCPA general data privacy (see gdpr-data-privacy skill), platform encryption at rest (see platform-encryption skill), or HIPAA health-data compliance.
industries-cpq-vs-salesforce-cpq
Use this skill when comparing Industries CPQ (formerly Vlocity CPQ) with Salesforce CPQ (Revenue Cloud managed package) — covering feature parity, decision criteria, migration paths, and coexistence patterns. Trigger keywords: Vlocity CPQ, Industries CPQ, Salesforce CPQ comparison, Revenue Cloud migration, CPQ selection, which CPQ to use. NOT for implementing, configuring, or debugging either CPQ product.
tableau-salesforce-connector
Tableau ↔ Salesforce integration patterns: Tableau Salesforce connector, Tableau for Salesforce, CRM Analytics alternative, Data Cloud + Tableau, embedded Tableau dashboards. Choose between connector modes (live, extract, direct-to-Data-Cloud). NOT for CRM Analytics Studio (use crm-analytics-foundation). NOT for generic Tableau Server setup.
slack-salesforce-integration-setup
Use this skill when setting up or troubleshooting the Salesforce for Slack managed app — including connecting a Salesforce org to a Slack workspace, configuring the three-party admin handshake, linking Slack channels to Salesforce records, enabling record preview sharing, and managing org-level limits. Triggers on: Salesforce for Slack app not connecting, Slack org connection setup, Salesforce record sharing in Slack, Slack workspace admin approval, connecting Salesforce to Slack. NOT for building custom Slack apps or Slack bots (separate development platform), not for Slack Workflow Builder Salesforce connector (use slack-workflow-builder skill), not for Flow-based Slack messaging (use flow-for-slack skill).
salesforce-to-salesforce-integration
Use this skill to implement Salesforce-to-Salesforce integration patterns — covering the native S2S feature, API-based cross-org sync, Platform Event bridging, and Salesforce Connect Cross-Org adapter. Trigger keywords: Salesforce to Salesforce integration, cross-org data sharing, S2S feature, cross-org Platform Events, Salesforce Connect cross-org. NOT for multi-org strategy or architecture decisions (use architect/multi-org-strategy), single-org data sharing, or external (non-Salesforce) system integration.
salesforce-maps-setup
Use when configuring Salesforce Maps (formerly MapAnything) — territory planning, route optimization, live tracking, geo-grid visualizations, and check-in/check-out workflows for Sales or Service field reps not on Field Service. Covers package installation order (Maps + Maps Advanced + Maps Routing/Live Tracking add-ons), the MapsTerritoryPlan / MapsAdvancedRoute / MapsLayer object family, base-data syncs (Geocoding and Routing services), and integration with Sales and Service Cloud records. Triggers: 'Salesforce Maps setup', 'MapAnything migration', 'territory planning by polygon', 'route optimization for sales reps', 'live tracking field reps', 'plot accounts on a map', 'check-in to the closest account'. NOT for Field Service Lightning territory and scheduling (use admin/fsl-scheduling-optimization-design and data/fsl-territory-data-setup) — Maps and FSL are different products. NOT for Consumer Goods Cloud retail visit planning (use admin/consumer-goods-cloud-setup) — RoutePlan/Visit objects are CG-specific. NOT for Tableau / CRM Analytics geo charts.
salesforce-functions-replacement
Salesforce Functions is retired (EOL Jan 2025). This skill maps Functions workloads to replacements: Heroku (with Hyperforce), external containers, Apex (where viable), Agentforce Actions, external compute via Named Credentials. NOT for Lambda / Azure Functions tutorials. NOT for Apex @future replacement (use async-selection tree).
salesforce-data-pipeline-etl
Export large Salesforce datasets to a lakehouse via Bulk API 2.0, CDC streams, or Salesforce Data Pipelines. NOT for ad-hoc exports.
salesforce-connect-external-objects
Use when deciding whether Salesforce Connect and External Objects are the right fit for external data access, or when reviewing OData, cross-org, and custom adapter patterns, query limitations, and latency tradeoffs. Triggers: 'Salesforce Connect', 'External Objects', '__x', 'OData adapter', 'custom adapter'. NOT for ordinary ETL or replicated-data designs where the data should live inside Salesforce.
outbound-webhook-from-salesforce
Use when Salesforce must POST a webhook to a third-party endpoint after a record change — with signed payloads, retries, dead-lettering, rate limits, and idempotency. Covers design choice between Outbound Message, Flow HTTP Callout, Apex Queueable callout, and Event Relay. Does NOT cover inbound webhooks into Salesforce (see inbound-webhook or apex-rest-webhook).
mulesoft-salesforce-connector
Designing and configuring MuleSoft Anypoint Salesforce Connector flows: API selection (SOAP/REST/Bulk/Streaming), OAuth 2.0 JWT Bearer auth, watermark-based incremental sync with Object Store, batch processing with record-level error isolation, and replay topic subscriptions. Use when building Mule 4 flows that read from or write to Salesforce, migrating from Mule 3 watermark to Mule 4 Object Store, or troubleshooting connector authentication and API limits. NOT for native Salesforce-to-Salesforce integration without MuleSoft (use platform-events-integration or change-data-capture-integration). NOT for generic REST callout patterns from Apex (use rest-api-patterns).