# Referral Automations

Referral automations do routine co-sell work for you. Most are switches on your co-sell configuration. A few live on the cloud partner's integration instead.

| Automation | What it does | Where to switch it on |
| --- | --- | --- |
| **[Auto-Share](#auto-share-referrals)** | Shares every CRM opportunity that meets your criteria to the cloud partner. | Configuration › Outbound › Settings |
| **[Auto-Enrich](#auto-enrich-referrals)** | Fills blank company and contact fields on a referral before you share it. | Configuration › Outbound › Settings |
| **[Auto-Delete (outbound)](#auto-delete-referrals)** | Deletes the CRM record when the cloud partner rejects your referral. | Configuration › Outbound › Settings |
| **[Auto-Link](#auto-link-referrals-aws-only)** | Links an accepted AWS Marketplace private offer to the AWS referral for the same deal. AWS only. | AWS ACE integration |
| **[Auto-Accept](#auto-accept-referrals)** | Accepts inbound referrals from AWS and Azure. | AWS ACE or Azure Marketplace integration |
| **[Auto-Delete (inbound)](#auto-delete-referrals)** | Deletes the CRM record when you reject an inbound referral. | Configuration › Inbound › Setting |
| **[Auto-Sync Contacts](#auto-sync-contacts)** | Writes contacts from inbound referrals into your CRM. | Configuration › Inbound › Setting |

Open your configuration in **Co-Sell › Settings › Configs**. See [Configuration](/cosell/setup/configuration/).

![A sample co-sell configuration with both Auto-Enrich and Auto-Share toggles enabled](../images/set-up-co-sell-in-settings-5.png)

## Auto-Share Referrals

Auto-share submits every opportunity that meets your sharing criteria, with no manual action. It uses your [outbound field mapping](/cosell/setup/configuration/#field-mapping) for every referral it shares.

:::info
**Auto-share runs every 3 hours.** The cadence is fixed and the same for every cloud partner. An opportunity that becomes eligible between runs is picked up on the next run.
:::

### Choose which opportunities to share (Salesforce)

The **Criteria** field under **Auto-Share Referrals** limits auto-share to the records you want. Only records that meet the condition go into the next run. The Criteria editor has two tabs:

| Tab | What you get |
| --- | --- |
| **Builder** | A visual condition tree. Pick a field, an operator and a value, and combine rows with AND / OR groups. |
| **Advanced (SOQL)** | The raw Salesforce SOQL predicate, evaluated against the selected Salesforce object. |

:::note
The two tabs are two views of **one** value. What you build visually is saved as a SOQL string. When you reopen the configuration, Fours turns the saved SOQL back into the Builder.
:::

Some SOQL has no Builder equivalent: subqueries, function calls and unary `NOT`. When Fours can't parse the saved predicate, it keeps you on **Advanced (SOQL)** and shows *"This query can't be edited in the Builder — keep it in Advanced (SOQL)."* The predicate still works.

**Builder operators** depend on the field type:

| Field type | Operators |
| --- | --- |
| **String / picklist** | `=`, `!=`, contains, not contains, starts with, not starts with, ends with, not ends with, is blank, is not blank, `IN`, `NOT IN` |
| **Number / date / datetime** | `=`, `!=`, `>`, `<`, `>=`, `<=` |
| **Boolean** | `=`, `!=` |

**Date values** can be absolute or relative:

| Mode | What you pick |
| --- | --- |
| **Absolute** | A date from the calendar picker. |
| **Relative** | A rolling Salesforce date literal: `TODAY`, `YESTERDAY`, `LAST_N_DAYS:7`, `LAST_N_DAYS:30`, `LAST_N_DAYS:90`, `LAST_90_DAYS`, `NEXT_90_DAYS`, `THIS_QUARTER`, `THIS_MONTH`. |

Use Relative when the window should move with time. For example, `LAST_N_DAYS:30` stays current without monthly edits.

**How Advanced (SOQL) is evaluated.** Fours embeds your predicate into a SOQL query.

- The object is **Opportunity** by default. You can name another object.
- For syntax and operators, see the [Salesforce SOQL guide](https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql.htm).
- Find field names in **Salesforce › Setup › Object Manager › \<Object\> › Fields & Relationships**. Use the **Field Name**.

:::note
- Field names must match exactly, including case.
- Use single quotes for strings.
- Invalid syntax makes auto-share fail.
:::

**Preview matches** runs the current criteria against Salesforce without saving. The **Opportunities matching your criteria** panel lists each match with its **ID**, **Name**, **Stage** and **Amount**. An empty result means nothing matches right now. Check it before you turn auto-share on.

### Choose which deals to share (HubSpot)

In HubSpot, a Segment (previously called a List) filters what auto-share picks up. Add the **Segment ID** to include only deals in that segment.

Find the ID in **HubSpot › CRM › Segments › \<Segment Name\> › Details › ILS Segment ID**. See the [HubSpot documentation](https://knowledge.hubspot.com/segments/create-active-or-static-lists).

### Retries

Auto-share retries a referral the partner rejected. A `CREATE_FAILED` referral goes back into the next run, and Fours updates the existing record instead of creating a duplicate.

| | |
| --- | --- |
| **Retried automatically** | `CREATE_FAILED` |
| **Never retried** | `UPDATE_FAILED`, `PENDING_CREATE`, `DRAFT` |
| **Retry limit** | 16 attempts, roughly 48 hours |

On AWS, a deal that fails Fours' own checks, before anything reaches AWS, is also saved as `CREATE_FAILED`, with the reason on its status, when the automatic fix can't repair it. An example is an **Estimated AWS Monthly Recurring Revenue** that is empty, 0 or not a number (see [Co-Sell Fields in ACE](/cosell/reference/ace-fields/#field-mapping-best-practices)). These count toward the same limit. Auto-share sends no Create Failed notification for them, so check the referral list.

After 16 attempts, the referral stays `CREATE_FAILED`. The cause is almost always data the partner keeps rejecting. Fix the field, then use [**Re-submit**](/cosell/referrals/outbound/#re-submit-a-failed-referral) on the referral.

## Auto-Enrich Referrals

Auto-enrich fills missing company and contact details when you preview or prepare a referral to share. It uses Fours AI. You see the filled values in the preview.

It fills only empty fields. It never overwrites data in your CRM, and it never writes to your CRM records at all.

### Three features called "enrichment"

Three features share the word *enrichment*. They do different things:

| Feature | What it fills | When it runs |
| --- | --- | --- |
| **Auto-Enrich Referrals** | Blank fields on the referral you are about to share, such as address, website and contacts | At share time, when the referral is previewed or prepared |
| **[CRM intelligence-signal enrichment](/cosell/ai/insights/#intelligence-signals-in-your-crm)** | Partner engagement and marketplace signals, written into mapped fields on your Salesforce or HubSpot records | Every 2 hours |
| **[AWS lead enrichment](/cosell/aws-programs/leads/#create-leads-from-salesforce-accounts)** | New AWS leads, created from your Salesforce Accounts | Once a day at 03:15 UTC while its automation is on |

![The co-sell configuration's Settings tab, with the Auto-Share Referrals and Auto-Enrich Referrals toggles, each with its own description](../images/50-cosell-settings-toggles.png)

### What the CRM record needs

Auto-enrich needs a starting point on the record:

- **For company details:** the company name, or its website or domain.
- **For contact details:** the contact's email, or their first and last name plus company details.

Without these, Fours AI can't find more. It may also find nothing for some companies.

### What it can fill

| Cloud partner | Company | Contact |
| --- | --- | --- |
| **AWS** | Name and website<br/>Full address (country, state, city, street, postal code)<br/>Industry | Email<br/>First and last name<br/>Job title |
| **Azure** | Name<br/>Full address (country, state, city, street, postal code) | Email<br/>First and last name<br/>Job title |
| **GCP** | Organization name and domain<br/>Full address (country, state or province, city, street, postal code)<br/>Industry<br/>Region and employee count | Email<br/>First and last name |

The exact fields can vary by partner integration.

## Auto-Delete Referrals

Auto-delete appears twice, once for each direction. The two trigger on different rejections:

| Setting | Triggers when | What it removes |
| --- | --- | --- |
| **Outbound** Auto-Delete | **The cloud partner** rejects your referral | The CRM opportunity or deal, and the referral in Fours |
| **Inbound** Auto-Delete | **You** reject an inbound referral | The CRM opportunity or deal, and the referral in Fours |

The referral is soft-deleted in Fours. Soft-deleted referrals are hidden by default and can't be reused or referenced.

## Auto-Link Referrals (AWS only)

Auto-link attaches an accepted AWS Marketplace private offer to the AWS referral for the same deal. The ACE opportunity then records the offer the deal transacted through.

Turn it on for your whole organization on the AWS ACE integration. In **Settings › Integrations**, click **Edit** on the AWS ACE integration and turn on **Auto-Link Referrals**. It works only on an ACE integration that uses the Partner Central API.

> <img src="/img/cosell/funding/ace_enable_funding_application.png" alt="Edit Integration dialog for AWS ACE (Partner Central API), with the Auto-Link Referrals switch turned on at the top, above Auto-Accept Referrals and the other ACE switches" style="max-width:512px;width:100%;display:inline;margin:0 auto;box-shadow:5px 5px 5px #eee" />

An offer and a referral belong to the same deal when both carry the same Salesforce opportunity, HubSpot deal or Dynamics 365 opportunity. Fours links them:

- **When the buyer accepts the offer**, if the matching referral is already in Fours.
- **Every 4 hours**, for any accepted offer that is still unlinked.

```d2
direction: down
accepted: "Buyer accepts the AWS\nMarketplace private offer"
run: "Every 4 hours:\naccepted offers still unlinked"
match: "Approved AWS referral\nfor the same deal?" { shape: diamond }
wait: "Not linked yet,\nthe next run tries again"
has: "ACE opportunity already\nhas an offer?" { shape: diamond }
keep: "Left as it is"
linked: "Offer linked to the\nACE opportunity"
accepted -> match
run -> match
match -> wait: "no"
match -> has: "yes"
has -> keep: "yes"
has -> linked: "no, at any ACE stage"
```

**Which referrals can be linked.** The AWS review status must be **Approved**, and no offer can be linked yet. Any ACE stage works, including **Launched**. Sellers often launch before the buyer accepts, and AWS accepts the link.

**Limits.**
- Each accepted offer links to one referral at most.
- A CPPO offer is never linked. Linking one by hand fails with *CPPO offers cannot be linked to an ACE opportunity*.
- When the ACE opportunity already has an offer, Fours leaves it alone.

**A removed link comes back.** If you remove a link in AWS Partner Central or with **Unlink Offer**, a later run links it again once Fours syncs the removal. This keeps happening while Auto-Link is on.

:::note
**Link Offer** and **Unlink Offer** by hand follow the same rules. They are on the referral's [AWS Marketplace transactions](/cosell/reference/ace-fields/#aws-marketplace-transactions) tab. They work once the AWS review status is **Approved**, at any stage. (**Approved** is AWS's own review status, not the Fours status. See [Status & Stage](/cosell/referrals/status/).) The offer must belong to the AWS account your ACE integration connects as, or have no seller account. An offer from another of your AWS Marketplace accounts is refused, with a message naming both accounts.
:::

## Auto-Accept Referrals

Auto-accept accepts inbound referrals from **AWS** and **Azure**. Google Cloud referrals are never auto-accepted.

Switch it on per cloud, on the integration:

- **AWS:** turn on **Auto-Accept Referrals** on the AWS ACE integration. Fours accepts an engagement invitation that is still **Pending** and has not expired.
- **Azure:** turn on **Auto-Accept Referrals** on the Azure Marketplace integration. The switch appears once **Enable Cosell** is on. Fours accepts a referral whose substatus is **Pending**.

Each accept runs as its own workflow, listed under **Metrics › Logs** with the **Auto-accept** type. See [Referral Syncing](/cosell/referrals/syncing/). On AWS, the accept goes to ACE. On Azure, it starts an outbound sync to Microsoft.

```d2
direction: right
ref: "Inbound referral\nfrom AWS or Azure"
check: "Pending, and\nAuto-Accept on?" { shape: diamond }
manual: "You accept or\nreject it yourself"
run: "Auto-accept run\n(Metrics › Logs)"
aws: "AWS: accept\nsent to ACE"
azure: "Azure: outbound sync\nto Microsoft"
col: "Auto Accepted ✓\n(when it was sent)"
ref -> check
check -> manual: "no"
check -> run: "yes"
run -> aws
run -> azure
aws -> col
azure -> col
```

**See what Fours accepted.** Add the **Auto Accepted** column from the **Columns** menu of the Cloud Partners referral table. It is hidden by default. A check means Fours sent the accept. Hover it to see when. The cloud partner confirms the accept separately.

Referrals you accept yourself never get a check. On Azure, an accept gets one only when it started a new sync to Microsoft. If a sync is already running, or your referral approval holds it, the accept is saved without a check.

## Auto-Sync Contacts

Auto-sync contacts writes contact details from inbound referrals, such as name, title, email and phone, into your CRM's contact records. Set **SyncMode** to "None" to manage contacts yourself.

:::note
For AWS, contacts usually sync 10 to 30 minutes after a referral is accepted.
:::

## Troubleshooting

| Issue | Cause | Fix |
| --- | --- | --- |
| Auto-share didn't share anything | Invalid SOQL (Salesforce) or a wrong ILS Segment ID (HubSpot) | Salesforce: click **Preview matches** and use single quotes for strings. HubSpot: check the ID against the segment's details. |
| A referral stays `CREATE_FAILED` | It hit the 16-attempt retry limit | Fix the field the partner rejects, then **Re-submit**. See [Retries](#retries). |
| Auto-enrich didn't fill fields | The CRM record has no company website or domain | Add the website on the Account or Company record. Fours uses it to look the company up. |

**Will auto-enrich overwrite data my reps entered?** No. It fills only empty fields.

**Can I auto-share for only part of my team?** Yes. Use the criteria (Salesforce) or a segment (HubSpot) to limit it to owners, regions or product lines. Use **Preview matches** to check first.
