# Automation rules

> Send or draft a document when a Salesforce record changes. Each rule becomes a real Flow in your org.

Tally Sign University › [Automation](https://www.tallysign.com/university/automation)

An automation rule says: when this kind of record changes like this, send this template. You set rules up in Tally Sign under **Settings → Automation**, which appears once Salesforce is connected. Only owners and admins can change them.

## Create a rule

1. Open **Settings → Automation** and choose **New rule**.
2. Under **When this kind of record**, pick the object, for example **Quote**.
3. Under **Changes like this**, choose **A field becomes a value**, **It's created** or **It's updated**.
4. For **A field becomes a value**, pick the **Field** and what it **Becomes**, for example Status becomes Approved.
5. Optional: under **Only if**, choose **Add condition**, for example Grand Total is greater than 10,000.
6. Pick the template under **Send this template** and give the rule a **Name**. The name is shown on the envelope in Salesforce.
7. Under **Then**, choose **Send it right away** or **Create a draft for the owner**.
8. Leave **Test mode** on for now and choose **Create rule**.

![The New rule dialog: when a Quote's Status becomes Approved, send Order Form, in test mode](https://www.tallysign.com/university/automation/new-rule.png)

*The sentence at the bottom reads the rule back to you.*

## Turn it on

A new rule is off. Turn on the switch next to it. Tally Sign deploys a record-triggered Flow to your Salesforce org and activates it, which takes up to a minute. The Flow calls the **Run Tally Sign automation rule** action, which hands the record to Tally Sign to fill and send the document. Editing or turning a rule on again replaces the Flow's older versions, so they don't pile up.

![The rules list with one rule on in test mode, and the run log](https://www.tallysign.com/university/automation/rules-and-log.png)

*On, with the Flow deployed. Every match appears in the Run log.*

> **Why it matters:** Because the trigger is a real Flow, it fires however the record changes: by a person, by an approval process, by an integration or by another Flow. A mass update of 200 records is handed to Tally Sign in one call and worked through in the background, so none are dropped.

> **Note:** Turning a rule off deactivates its Flow. Deleting a rule removes the Flow from Salesforce and deletes its run log. If the Flow can't be removed, the rule is kept and says why. When Salesforce needs reconnecting, either reconnect and delete again, or choose Delete anyway and then delete the Flow in Salesforce Setup → Flows.

## Test mode

In test mode, the rule runs on every matching change but sends nothing. The **Run log** shows who would have received the document, for example **Test: would send to Dana Whitfield.** Leave a rule in test mode for a few days, check the log, then choose **Turn off test mode** from the rule's menu.

## The run log

| Outcome | Meaning |
| --- | --- |
| **Queued** | Tally Sign has the record and runs it in a moment. If Salesforce can't be reached, it waits and tries again, and the reason says why. |
| **Sent** | The document went out. The reason lists who got it and who it was sent as. |
| **Draft** | A draft was created, because the rule creates drafts, or because a signer or value was missing. |
| **Test** | Test mode: what would have happened. |
| **Skipped** | The record didn't match the conditions, it already has a document from this template, the rule is off, or Salesforce is disconnected. |
| **Error** | Something went wrong. The reason says what. |

Filter the log by rule. **Open document** opens the document a run created or found.

## Built-in safety

- **No duplicates.** If the record already has a draft or sent document from the same template, the run is skipped: **A sent envelope from this template already exists for the record.** When it's someone's draft that's in the way, the record owner gets a bell notification, **Draft waiting**, to send or delete it. Turn on **Once per record** to also skip records that already have a signed document from the template, for example when a signed quote is approved again.
- **No incomplete sends.** If no signer is found or a required value is empty, Tally Sign creates a draft instead of sending, and sends the record owner a bell notification that says what's missing: **Needs a signer** or **Needs details**. If the send itself fails, the bell says **Couldn't send** and why.
- **Sent by the record owner.** Automated documents go out as the record owner when they have a seat, so it's their name on the email, their inbox, their notifications and their countersignature. If the owner has no seat, the person under **When the record owner has no seat, send as** sends it; if they have no seat either, an admin with one does. A rule in draft mode leaves the draft with that person and sends the record owner a **Draft ready** bell.
- **Updates need a condition.** A rule on **It's updated** needs at least one condition, so it doesn't run on every edit.

> **Watch out:** If Salesforce is disconnected, its rules are turned off and their Flows are removed from Salesforce. The rules stay listed so you can delete them or move them to another connected org. If Salesforce's sign-in expires, runs wait as **Queued** and go out once an admin reconnects (for up to three days). After that they show as **Error** and owners and admins get an email. Runs Tally Sign turns away, for example after the connection key changed, are logged as **Error** too. If some records of a mass update are turned away, the others still run and Tally Sign admins in Salesforce get a bell notification instead of a failed Flow.

Next guide: [Flow and Agentforce actions](https://www.tallysign.com/university/automation/flow-and-agentforce-actions)

Source: https://www.tallysign.com/university/automation/automation-rules
