# Flow and Agentforce actions

> Send, check, remind and void from any Flow or Agentforce agent with the Tally Sign actions.

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

The package adds invocable actions in the **Tally Sign** category. Use them in Flow Builder (**Action** element) or add them to an agent in Agentforce as agent actions.

## The actions

| Action | Inputs | Outputs |
| --- | --- | --- |
| **Send for signature** | Record ID; Template (pick from the list, or a template ID) or Template Name; Mode (`send` or `draft`); optional Signer Contact ID, or Signer Email and Signer Name; Message; Send As; Fail the Flow on error | Succeeded, Sent, Document ID, Status, Editor URL, Issues, Error Message |
| **Get signature status** | Record ID (the newest envelope on the record, drafts included) or Document ID; Fail the Flow on error | Found, Status (`draft`, `sent`, `expired`, `completed`, `declined` or `voided`), Signers Completed, Signers Total, Title, Sent At, Completed At, Envelope Count |
| **Send signing reminder** | Document ID, or Record ID for the newest envelope waiting for signature; Fail the Flow on error | Succeeded, Reminded, Document ID, Error Message |
| **Void envelope** | Document ID, or Record ID for the newest envelope still out for signature (expired ones included, never drafts), and a Reason; Fail the Flow on error | Succeeded, Document ID, Error Message |
| **Run Tally Sign automation rule** | Rule ID, Record ID | Outcome, Reason, Document ID. Used by the Flows that automation rules create |

**Succeeded** on Send for signature is true when the document went out, or when it was saved in draft mode. If a send could only save a draft (a signer or value was missing), Succeeded and **Sent** are false and **Error Message** says why. **Expired** means the envelope was sent but its signing links ran out before everyone signed.

By default an action doesn't fail the Flow: it returns Succeeded = false and an Error Message, so your Flow can decide what to do. Set **Fail the Flow on error** to true to fail it instead, so a Fault path or Salesforce's Flow error email handles it.

To find a template ID for Template, open the template in Tally Sign and choose **More → Copy template ID**. Picking from the list stores the ID for you; Template Name matches the template's name instead.

## Which user a Flow runs as

Sending needs a Tally Sign seat for the person the document is sent as. Which Salesforce user a Flow runs as depends on the kind of Flow:

| Flow | Runs as | What to do |
| --- | --- | --- |
| Screen Flow, quick action | The person using it | They need a seat to send. |
| Record-triggered Flow (Run Asynchronously path) | The person, integration or process whose change triggered it | Set **Send As** to `Record owner` on Send for signature, so the document goes out as the record owner and whoever changed the record doesn't need a seat. |
| Schedule-triggered Flow | The Default Workflow User in Setup → Process Automation Settings | Give that user a seat, or set Send As. |
| Platform event-triggered Flow | Salesforce's Automated Process user | Nothing: sends go out as the record owner, and reminders and voids act as the person who sent the document. It never takes a seat. |

Integration and API-only users (Data Loader, a middleware account) send as the record owner even with Send As blank.

**Send As** also takes a Salesforce user ID; that user needs a seat. Sending as someone else is for Flows run by automation or integration users, people with a seat of their own, and users with the **Tally Sign Admin** permission set; anyone else gets an error, so nobody can send under a colleague's name without a seat.

**Send signing reminder** and **Void envelope** don't need a seat and never take one. Without one, they act as the person who sent the document, when the Flow runs as automation or an integration user, as someone with the Tally Sign Admin permission set, or as someone who can edit the record the document was sent from.

Automation rules don't need any of this: they always send as the record owner, the rule's owner or an admin.

## Record-triggered Flows

Salesforce doesn't allow calls to other systems while a record is being saved. In a record-triggered Flow, put Tally Sign actions on a **Run Asynchronously** path:

1. In the Start element, choose **Optimize the Flow for Actions and Related Records**.
2. Select **Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed**.
3. Add the Tally Sign action on the **Run Asynchronously** path, not the **Run Immediately** one.

Placed on the immediate path, the action fails with **Salesforce doesn't allow calls to Tally Sign in the same step as a record save.**

> **Note:** A mass update runs the path for up to 200 records at once. When a batch is too big for Salesforce's limit on calls in one transaction, or Tally Sign can't be reached, Send for signature returns Status `queued` for the rest (reminders and voids say so in Error Message) and the package tries those calls again in the background, up to four times over about a quarter of an hour. Retries never send a document twice. If a call still doesn't go through, users with the Tally Sign Admin permission set get a bell notification saying what wasn't done.

## Example: remind signers after three days

1. In Setup, open **Flows** and choose **New Flow → Schedule-Triggered Flow**. Run it daily.
2. Set the object to **Envelope**, with the condition **Status** equals **Sent**.
3. Add a **Decision** that continues only when **Last Activity** is more than three days ago.
4. Add an **Action**, search for **Send signing reminder** and set **Document ID** to the envelope's **Tally Sign ID**.
5. Save and activate.

> **Note:** Schedule-triggered Flows run as the Default Workflow User (Setup → Process Automation Settings). Reminders go out when that user has a Tally Sign seat, the Tally Sign Admin permission set or Modify All Data (System Administrator has it), or can edit the record each document was sent from. Without a seat, the reminder is sent as the person who sent the document.

## Agentforce

In Agent Builder, add a new agent action of type **Apex** and pick one of the Tally Sign actions. Give it clear instructions, for example:

```
Send for signature: use when the user asks to send the order form for a quote.
Always use mode "draft" unless the user clearly asks to send now.
```

> **Why it matters:** Reps can ask the agent "has Brightline signed yet?" or "send the order form for this quote" from any record.

## React to envelope changes

Once for each change, after the envelope is updated, Tally Sign publishes the platform event **Tally Sign Event** (`TallySign__Tally_Sign_Event__e`) with the envelope, the related record, the event type and the status. You can also trigger a record-triggered Flow on the **Envelope** object itself, as in the Slack recipe.

To act on one kind of change, filter on **Event Type**, for example `document.completed`, `document.declined`, `recipient.signed`, `comment.created` or `redline.created`. Status alone matches every later change too, such as a comment after signing.

Next guide: [Recipe: post to Slack when a deal is signed](https://www.tallysign.com/university/automation/slack-recipe)

Source: https://www.tallysign.com/university/automation/flow-and-agentforce-actions
