> For the complete documentation index, see [llms.txt](https://university.gonexa.fr/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://university.gonexa.fr/sign/en/advanced-features/sign-and-flows/automate-sending-for-signature.md).

# Automate sending for signature

Speed up the steps of sending for signature with an automated process

{% hint style="info" %}
**Prerequisites — before you start**

* Have a document template
* Have configured a simple signature send
* Have thoroughly tested the template with a simple send before sending via a flow
  {% endhint %}

{% embed url="<https://www.youtube.com/watch?v=UXjGEJ3Rg-Q>" %}

## Step 1: Flow initialization

* In Setup, create a Screen Flow
* Name it properly, following your company's naming conventions
* Create a "recordId" variable available for input if you want to create a screen flow

{% hint style="warning" %}
**Tip**

You can build a flow that generates and sends for signature, or one that only sends for signature, depending on what you want to do. Here, we explain a complete generation and sending flow
{% endhint %}

## Step 2: Document generation

* Add an Apex Action element to your flow
* Select the "Generate a Document" action: `apex-gnc__DocumentGenerationInvocable`
* Name it "GenerateDocument"

Enter the following 3 elements:

* **Output format**: "pdf", "xlsx", "pptx" or "docx" (hardcoded or set dynamically, as you choose)
* **Record Id**: retrieve the Salesforce ID of the starting record here. For example, use the "recordId" variable created initially.
* **Template Id**: retrieve the Salesforce ID of the document template of your choice here. For example, you can display a picklist on the first screen and use the ID of the template selected by the user here

## Step 3: Get the generated document

* Add a Get Records element to your flow.
* Enter a label and an API name.
* Select the "Document template log" object

Filter the records with the following criteria:

* **Field**: Id
* **Operator**: Equals
* **Value**: equal to "Text from "GenerateDocument" (name of the Apex Action performed previously)

## Step 4: Recipient creation

* Add an Action element to your flow.
* Select the "Create a certified recipient" action: `apex-gnx__CertifiedRecipientInvocable`.
* Enter a label and an API name: for example "CreateRecipient".

Enter the following 2 elements:

* **Contact, User or Lead Id**: specify the Salesforce ID of the Contact, User or Lead who will receive the document for signature. For example, you can place a lookup field on the initial screen or dynamically search for the right record.
* **Recipient Order**: enter the signer order, for example "1"
* **Signature level**: enable this parameter to send an advanced or qualified signature. Enter "**advanced**" for an advanced signature, and "**qualified**" for a qualified signature.
* **New transaction:** In the "Show advanced option" dropdown menu at the bottom, make sure to check the "Always start a new transaction" box

## Step 5: Create the collection variables (Contact + Recipient)

Create a new resource

* **Resource Type**: Variable
* **API Name**: "ContactCollection"
* **Data Type**: Text
* Check the "Allow multiple values (collection)" box

Create a new resource

* **Resource Type**: Variable
* **API Name**: "RecipientCollection"
* **Data Type**: Text
* Check the "Allow multiple values (collection)" box

## Step 6: Assign values to the created variables

Add an "Assignment" element

In the first assignment row

* **Variable**: ContactCollection
* **Operator**: Add
* **Value**: Signer Contact ID

Add a second row to the assignment with:

* **Variable**: RecipientCollection
* **Operator**: Add
* **Value**: Text from "CreateRecipient"

## Step 7: Create the signature request (Delivery)

* Add an Apex Action element to your flow
* Select the "Create a certified delivery" action: `apex-gnx__CertifiedDeliveryInvocable`.
* Name it "CreateDelivery"

Add an "Action" element:

* **Collection of Contacts Ids**: the "ContactCollection" collection variable
* **Collection of Recipients**: the "RecipientCollection" collection variable
* **Content Document Id**: the ID of your document via "Get Generated Document"
* **Name**: enter a name, for example "Signature Process"
* **Collection of Content Version Ids**: you can enable this parameter if you want to send multiple documents in the same procedure. Then enter the collection variable in which you previously stored the IDs of the content versions to send for signature
* **Document Template Id:** the ID of the document template used. This value is not mandatory, but it is highly recommended to fill it in for the signature request to work properly
* **New transaction:** In the "Show advanced option" dropdown menu at the bottom, make sure to check the "Always start a new transaction" box

Save, debug and activate your flow.

Don't forget to add a flow component to the Lightning page of your choice.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://university.gonexa.fr/sign/en/advanced-features/sign-and-flows/automate-sending-for-signature.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
