---
title: "Send SignNow Template on a schedule"
url: "https://docs.signnow.com/docs/apex-send-template-scheduled"
type: "page"
section: "Integrations"
slug: "apex-send-template-scheduled"
---

# Send SignNow Template on a schedule

# Send SignNow Template on a schedule

Send a SignNow template for signature to a batch of Salesforce records on a set date and time via a schedule-triggered flow.

> [!NOTE]
> Before configuring this Apex action, review the [prerequisites](/docs/salesforce-apex-actions#prerequisites) for SignNow Apex actions and complete the required setup steps.

The flow uses the **Send SignNow Template** action and can run, for example, every morning or once a week. You don't need to write code for this.

On each run, the flow does the following:

1. Finds all records that match the filter conditions.
2. Sends the SignNow template for signature for each record.
3. Marks each record as sent, so the next run skips it.

In this example, we'll send a template for signature once for each Account marked for sending, and mark each Account after the template is sent.

> [!NOTE]
> Your Salesforce admin sets up and maintains this flow in your Salesforce org.

The template is sent on behalf of the integration user set in **Setup > Custom Settings > SignNow Settings**. Recipients get the invite from this user's SignNow account.

## Step 1. Prepare the record fields

The flow needs two things from each record:

- **A selection condition.** It tells the flow which records to send the template for.
- **A "sent" flag.** The flow sets it after sending, so the next run doesn't send the template again for the same record.

You can use fields that already exist on the object, for example an Opportunity **Stage** as the selection condition and a status field as the flag. In this example, we'll create two checkbox fields on the Account object.

1. Go to **Setup > Object Manager > Account > Fields & Relationships** and click **New**.

![apex_scheduled_new_field.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_new_field.png)

2. Select **Checkbox** and click **Next**.

![apex_scheduled_checkbox_type.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_checkbox_type.png)

3. Enter the field label, set **Default Value** to **Unchecked**, and click **Next**. Create two fields this way:
   - **SignNow Test** (`SignNow_Test__c`): you select it on the records that need the template.
   - **SignNow Sent** (`SignNow_Sent__c`): the flow selects it after sending the template.

![apex_scheduled_field_details.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_field_details.png)

> [!TIP]
> The field names in this example are arbitrary. Name the fields according to your needs, for example, **Send for Signature**, and use the same names in the flow conditions.

4. On the field-level security step, make sure the fields are visible and not read-only for the profiles that will edit them. On the last step, add the fields to the page layout. Click **Save**.

> [!NOTE]
> If the checkboxes appear on the record but can't be selected when you edit it, the field is read-only. Open the page layout, click the wrench icon next to the field, and clear **Read-Only**. Also check the field-level security for your profile.

![apex_scheduled_field_read_only.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_field_read_only.png)

5. Open the records that need the template and select **SignNow Test**. Leave **SignNow Sent** unchecked.

![apex_scheduled_mark_record.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_mark_record.png)

## Step 2. Create a schedule-triggered flow

Go to **Setup > Flows > New Flow**. In the **New Automation** dialog, select **Schedule-Triggered Flow**.

![apex_scheduled_flow_type.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_flow_type.png)

## Step 3. Set the schedule

In the **Start** element, click **Set Schedule** and set the following:

- **Start Date** and **Start Time**: when the first run starts. The time uses your org's default time zone, which you can check on the **Setup > Company Information** page.
- **Frequency**: how often the flow runs: **Once**, **Daily**, or **Weekly**. Choose the frequency that matches how often you need to send documents.

![apex_scheduled_set_schedule.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_set_schedule.png)

## Step 4. Choose the records

In the **Start** element, click **Choose Object** and set the following:

- **Object**: the object whose records the flow processes. For our example, it is **Account**.
- **Condition Requirements**: **All Conditions Are Met (AND)**.
- Conditions:
  - `SignNow Test` **Equals** `True`
  - `SignNow Sent` **Equals** `False`

The flow runs once for each record that meets the conditions. Inside the flow, the current record is available in the `$Record` global variable.

![apex_scheduled_choose_object.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_choose_object.png)

> [!TIP]
> **Max Batch Size** is optional. Leave it empty to use the Salesforce default.

## Step 5. Add the Send SignNow Template action

Under the **Start** element, click the **+** icon and select **Action**. Start typing *signnow* and select **Send SignNow Template**.

Configure the action:

- Enter an action label, for example, **Send SignNow Template**.
- **Record ID**: select **Triggering Account > Account ID** (`{!$Record.Id}`).
- **SignNow Template ID**: enter the ID of the template to send. Copy it on the **SignNow Admin Tools** > **Templates** page.
- (Optional) **SignNow Document Flow ID**: enter the ID of a pre-configured document flow. If you add it, the template is sent according to this flow. Copy it on the **SignNow Admin Tools** > **Document Flows** page.

![apex_scheduled_action_config.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_action_config.png)

> [!IMPORTANT]
> If you add a document flow:
>
> - Add the same recipient steps as in the template, with the same names.
> - Configure the flow to send without sender input: hide all sender screens and set an email address or tag for every recipient.
>
> See [Document flows](/docs/document-flows).

## Step 6. Mark the records as sent

Add this element **after** the Send SignNow Template action.

1. Under the action, click the **+** icon and select **Update Records**.
2. Enter a label, for example, **Mark SignNow Sent**.
3. Under **How to Find Records to Update and Set Their Values**, select **Use the account $Record global variable**.
4. Under **Set Filter Conditions**, leave **None—Always Update Record**.
5. Under **Set Field Values for the Account Record**, set **SignNow Sent** to **True**.

![apex_scheduled_update_records.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_update_records.png)

The flow looks like this: **Start** → **Send SignNow Template** → **Mark SignNow Sent** → **End**.

## Step 7. Save and activate the flow

Save and activate the flow as described in [Send SignNow Template](/docs/apex-send-template).

> [!WARNING]
> Activate the flow before the start time you set.

To check that the run is scheduled, go to **Setup > Scheduled Jobs**. The flow is listed with the **Scheduled Flow** type and the next run time.

![apex_scheduled_jobs.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_jobs.png)

## Result

At the scheduled time, the flow sends the template to the recipients configured in the template or SignNow document flow, once for each matching record. It then selects **SignNow Sent** on each record, so the next run skips it.

The SignNow action sends the template in a background Apex job, so the documents might go out a few minutes after the flow starts. To check the job status, go to **Setup > Apex Jobs** and find the **SendTemplateController** job.

![apex_scheduled_apex_jobs.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_apex_jobs.png)

After the run, **SignNow Sent** is selected on each processed record.

![apex_scheduled_record_sent.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_record_sent.png)

To send the template for a record again, clear **SignNow Sent** on that record. The next run will include it.

## Troubleshooting

If the documents aren't sent, check the following:

- **Setup > Paused and Failed Flow Interviews**: open the **All Failed Flow Interviews** list view to see flow errors.
- **Setup > Apex Jobs**: check the status and failures of the **SendTemplateController** job.
- **The invite stays in Draft in the Invites Status widget**: the document flow waits for input from the sender. On the **SignNow Admin Tools** > **Document Flows** page, hide all sender screens and set an email address or tag for every recipient. Check that recipient tags point to fields with values on the record.
- **Document flow steps**: if you added a SignNow Document Flow ID, check that the recipient steps in the document flow match the steps in the template, including their names.
- **The flow didn't run at all**: make sure at least one record meets the filter conditions and that the flow was activated before the start time.
- **Flow error emails**: to choose who receives them, go to **Setup > Process Automation Settings** and set **Send Process or Flow Error Email to**.

![apex_scheduled_error_email.png](/reference-assets/images/SignNow_Salesforce/apex_actions/apex_scheduled_error_email.png)

---

View the full list of [SignNow Apex actions](/docs/salesforce-apex-actions).


---
*Full page: https://docs.signnow.com/docs/apex-send-template-scheduled*
