> ## Documentation Index
> Fetch the complete documentation index at: https://docs.momentum.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting Up Retropilot

> A guide to configuring Retropilot to trigger extractions based on Salesforce events and historical call/email data.

<CardGroup cols={3}>
  <Card title="Autopilot Classic" icon="plane" href="/autopilot-classic-setup">
    Triggers after each call/email to analyze its content in real-time.
  </Card>

  <Card title="Retropilot" icon="clock-rotate-left" href="/retropilot-setup">
    **You are here.** Triggers on a Salesforce event and analyzes all historical
    conversations.
  </Card>

  <Card title="Autopilot Batch" icon="files" href="/autopilot-batch-setup">
    Triggers manually to run on a large set of records that match your defined
    criteria.
  </Card>
</CardGroup>

# Setting Up Retropilot

Retropilot, part of the Autopilot Suite, allows you to trigger powerful AI extractions based on **Salesforce events**. Unlike the real-time Autopilot, Retropilot analyzes all [historical conversational data](/conversational-data-sources) within a specified timeframe to provide comprehensive insights right when a key moment occurs in your CRM.

## How Retropilot Works

Retropilot operates on a simple but powerful flow: a Salesforce event triggers an AI analysis of historical conversational data, which then results in an update to a Salesforce field.

```mermaid theme={null}
graph LR
    A(Salesforce Event) --> B{Retropilot Trigger};
    B --> C((Analyze<br/>History));
    C --> D[/Run AI Prompt/];
    D --> E>Update Field];
```

## Use Cases for Retropilot

* **New Opportunity Stage**: When an opportunity moves to "Proposal," automatically summarize all previous call notes related to budget and timeline.
* **Account Ownership Change**: When a new account owner is assigned, generate a summary of the customer's key pain points and historical issues.
* **Pre-Renewal Analysis**: 90 days before a renewal date, compile a list of all mentioned competitors and feature requests from the past year.

## Step-by-Step Configuration

### Step 1: Access the Retropilot Section

1. Log in to your [Momentum admin dashboard](https://app.momentum.io/admin/autopilot-extractions).
2. Navigate to the **Autopilot** section and select the **Retropilot** tab.
3. Click **"New Retropilot Extraction"** to begin.

### Step 2: Define the Salesforce Trigger Event

This is the core of Retropilot. You'll define the specific Salesforce event that initiates the extraction.

<Note>
  In certain cases, you may instead need to [configure an advanced self-managed
  Salesforce Flow](/user-managed-salesforce-flows).
</Note>

* **Object**: Select the Salesforce object (e.g., Opportunity, Account, Case).
* **Trigger Action**:
  * `On Create`: Runs when a new record of the selected object is created.
  * `On Update`: Runs when a record is modified.
  * `On Create & Update`: Runs for both creation and modification.

<img src="https://mintcdn.com/momentum/2rFJIHICv7FZn6Ha/images/autopilot/retro-step-1.png?fit=max&auto=format&n=2rFJIHICv7FZn6Ha&q=85&s=270cf72bbef88c2e72301a40e6a78b63" alt="Retropilot Configuration Interface" width="2728" height="1622" data-path="images/autopilot/retro-step-1.png" />

To prevent the trigger from firing on every small change, you must specify field conditions when using `On Update`.

* **Field**: Choose the field to monitor (e.g., `StageName`, `OwnerId`).
* **Condition**:
  * `Changes to`: Triggers only when the field's value changes *to* a specific value (e.g., StageName changes to "Closed Won"). This is the recommended and most precise way to control triggers.
  * `Is`: Triggers if the field has a certain value after the update. Use with caution as this can fire on unrelated record updates.

**Example Trigger:**

```yaml theme={null}
Object: Opportunity
Trigger Action: On Update
Field: StageName
Condition: Changes to "Negotiation"
```

### Step 3: Set the Time Window

Define the period of [historical conversational data](/conversational-data-sources) that Retropilot should analyze. This can be anything from the last 7 days to the entire history of the record.

### Step 4: Write Your AI Prompt

This prompt will guide the AI in its analysis of the historical conversational data. Make sure your prompt is clear about what you want summarized or extracted.

**Example Prompts:**

* **For a "Negotiation" Stage Trigger**:
  ```text theme={null}
  "Review all calls and emails from the last 90 days for this opportunity. Summarize all discussions related to budget, key decision-makers, and final blockers. List the key contacts involved."
  ```
* **For a "New Owner" Trigger**:
  ```text theme={null}
  "Analyze all historical call data for this account. Provide a summary of the top 3 pain points mentioned and any outstanding support tickets or unresolved issues."
  ```

### Step 5: Configure Save Behavior

Choose how the extracted data is saved to Salesforce, just like a regular Autopilot extraction.

* **Confirm to Write**: Requires manual approval in Slack.
* **Write if Empty**: Only writes if the target field is blank.
* **Automatic Write**: Always writes the new value.

**Handling Records with No Context:**

You can configure what happens when no relevant [historical conversational data](/conversational-data-sources) is found for a record:

* **Skip**: Nothing will be written to Salesforce (default behavior)
* **Write Reason**: Write a message explaining why no data could be extracted
* **Custom Text**: Write custom text that you specify

This ensures fewer missed write-backs and maintains data consistency even when context is missing.

<Note>
  This setting still respects your save behavior configuration. Confirm to
  Write, Write if Empty, and Automatic Write settings will still apply.
</Note>

<Note>
  Retropilot automatically truncates extracted values to fit the target field's
  maximum length in Salesforce.
</Note>

<img src="https://mintcdn.com/momentum/2rFJIHICv7FZn6Ha/images/autopilot/retro-step-2.png?fit=max&auto=format&n=2rFJIHICv7FZn6Ha&q=85&s=69b387d5b195333ae9183ad88907fff6" alt="Retropilot Configuration Interface" width="2584" height="1332" data-path="images/autopilot/retro-step-2.png" />

### Step 6: Test and Activate

* **Preview**: Test your Retropilot configuration against existing Salesforce records that meet your trigger criteria to see what the output would look like.
* **Activate**: Once you're confident, activate the Retropilot rule to have it run automatically based on your trigger.

<img src="https://mintcdn.com/momentum/2rFJIHICv7FZn6Ha/images/autopilot/retro-step-3.png?fit=max&auto=format&n=2rFJIHICv7FZn6Ha&q=85&s=d615cb83df28ce899a5728fa1cc98ca5" alt="Retropilot Configuration Interface" width="2602" height="708" data-path="images/autopilot/retro-step-3.png" />
