Skip to content

PranavNagrecha/AwesomeSalesforceSkills / skills/admin/einstein-discovery-setup

einstein-discovery-setup

Verified

Use this skill when an admin needs to create an Einstein Discovery story in CRM Analytics Studio, configure prediction definitions, deploy writeback fields, set up what-if analysis, or manage model refresh and activation. Trigger keywords: Einstein Discovery story, prediction definition, writeback field, CRM Analytics Studio, model refresh, what-if analysis, bulk scoring, prediction field, 1OR prefix. NOT for the Einstein Discovery Flow action or model-health monitoring in Model Manager — use admin/einstein-discovery-deployment. NOT for Einstein Prediction Builder, a separate product needing no CRM Analytics license — use agentforce/einstein-prediction-builder. NOT for programmatic scoring through the Connect REST API — use agentforce/einstein-discovery-development.

references/gotchas.md

View on GitHub
# Gotchas: Einstein Discovery Setup

Non-obvious Einstein Discovery behaviors that cause real production problems. The grounded source is the Summer '26 Metadata API Developer Guide (`DiscoveryAIModel`, `DiscoveryGoal`), cited as `api_meta L<n>` from its `pdftotext -layout` extraction. The Einstein Discovery admin pages (help.salesforce.com) and the Einstein Discovery REST API guide did not fetch for this pass, so UI behavior carried from earlier versions of this skill carries an inline `UNVERIFIED (2026-10-03):` marker.

## Gotcha 1: Removing `pushbackField` from the goal metadata deletes the field

**What happens:** `DiscoveryGoal.pushbackField` is the "automated writeback field for predictions. A custom field on the Salesforce object specified in subscribedEntity." The guide warns: "Removing a pushback field from the goal metadata causes the field to be deleted from the Salesforce object as well" (`api_meta L54794-54800`).

**When it occurs:** A developer retrieves a `DiscoveryGoal` from a sandbox where writeback was not set up, or edits the file and drops the element, then deploys to production. The production writeback field and its values are deleted.

**How to avoid:** Treat the goal file as the owner of the writeback field. Review every `DiscoveryGoal` diff for a removed `pushbackField` before deploying, and block such deploys in code review. Retrieve from the org that holds the real writeback configuration.

---

## Gotcha 2: Up to ten active models per prediction definition, and the first matching filter wins

**What happens:** A prediction definition "is associated with one or more deployed models. If a prediction definition contains multiple models, then each model produces predictions for a different segment of the data. A prediction definition can contain up to ten active models" (`api_meta L54747-54751`). For deployed model filters: "When making a prediction, the first model that has filters matching a specific input row will be used to make the prediction. No filters indicates that the model matches all input rows" (`L54833-54838`).

**When it occurs:** A broad model with no filters is listed before segment models, so it scores every row; or an eleventh segment model is planned.

**How to avoid:** Order deployed models from most specific filter to least, and put the unfiltered catch-all last. Merge segments if the plan needs more than ten active models.

---

## Gotcha 3: Models are not authored through the Metadata API

**What happens:** "Write operations for DiscoveryAIModel objects are generally not supported" (`api_meta L54458`). A model is stored in the `discovery` folder as a `.model` file with the model data and a `-meta.xml` file (`L54469-54471`). The `UserUpload` source type (a model built in an external tool) "is not supported in the Metadata API" (`L54655-54665`).

**When it occurs:** A team hand-edits a model file to change thresholds or fields, or tries to deploy an externally trained model through a package.

**How to avoid:** Build and change models in Einstein Discovery, upload external models through Model Manager, and use the Metadata API to retrieve and version them. Deploy models only as retrieved.

---

## Gotcha 4: `pushbackType` must be `AiRecordInsight`

**What happens:** `DiscoveryPushbackType` "represents the type of writeback field. Must be set to AiRecordInsight." The other value, `Direct`, is "currently not supported. Reserved for future use" (`api_meta L55069-55076`).

**When it occurs:** A goal file is written by hand or generated by a script that guesses a "direct" writeback.

**How to avoid:** Keep `<pushbackType>AiRecordInsight</pushbackType>` wherever `pushbackField` is set.

---

## Gotcha 5: Accuracy monitoring needs a terminal-state definition

**What happens:** `terminalStateFilters` are "one or more filter expressions that define the conditions under which an observation has attained its terminal state (the actual outcome has been reached). For performance monitoring, Einstein Discovery determines model accuracy by comparing a model's predicted outcomes with actual (observed) outcomes" (`api_meta L54806-54812`).

**When it occurs:** A win-prediction goal has no terminal-state filters, so open opportunities are counted as outcomes, and accuracy reporting is misleading.

**How to avoid:** Define terminal states explicitly (for example `IsClosed` equals true for an Opportunity win model) in the prediction definition, and record them in the refresh runbook.

---

## Gotcha 6: Model fields carry sensitive and disparate-impact flags that someone must review

**What happens:** Each `DiscoveryModelField` has `isSensitive` and `isDisparateImpact` booleans (`api_meta L54555-54562`). They mark fields that need a fairness review before scores are used for decisions.

**When it occurs:** Stories built from wide datasets include demographic fields or proxies (postal code, for example), and nobody reads the flags before deployment.

**How to avoid:** Make a sensitive-field review a deployment gate. Record which flagged fields were kept and why, or remove them from the explanatory variables.

---

## Gotcha 7: Leakage fields inflate training accuracy

**What happens:** Fields populated only after the outcome (for example a close-related field on a win prediction) make the model look accurate in training and useless on open records.

**When it occurs:** Explanatory variables are chosen by "include everything" on the object.

**How to avoid:** For each candidate field, ask whether its value is known at the moment a prediction is needed. Exclude it if not. This is modeling practice rather than platform behavior; UNVERIFIED (2026-10-03): whether the story wizard flags likely leakage fields is help-only.

---

## Gotcha 8: Writeback visibility, freshness, and activation are unverified help-only claims

**What happens:** Earlier versions of this skill stated four behaviors as fact: the writeback field receives no field-level security by default and is invisible to every user until granted; it updates only through bulk scoring jobs or explicit API calls, never on record save; each object holds at most three writeback fields; and a refreshed model stays inactive until an admin activates it. UNVERIFIED (2026-10-03): none of these is described in the Metadata API guide, and the help pages that state them did not fetch. The metadata does show that each deployed model and the prediction definition carry `active` flags (`api_meta L54780`, `L54824`).

**When it occurs:** Users are told scores refresh on edit, or that a fourth prediction "cannot" be added, without anyone testing.

**How to avoid:** In a sandbox, grant field-level security explicitly (it does no harm if already granted), edit a scored record and watch the field, and check activation after a refresh. Write the observed behavior into the runbook.
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 323kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall