---
title: "Create SignNow Document Group from Template"
url: "https://docs.signnow.com/docs/apex-create-document-group-from-template"
type: "page"
section: "Integrations"
slug: "apex-create-document-group-from-template"
---

# Create SignNow Document Group from Template

# Apex action: Create SignNow Document Group from SignNow Template and Get SignNow Document Group Recipients

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

The **Create SignNow Document Group from SignNow Template** action allows users to create a document group without sending it for signature. The document group can then be used with other SignNow Apex Actions.

The **Get SignNow Document Group Recipients** action allows users to retrieve information about recipients, including email addresses, signing order, assigned documents, and more.

In this example, we will configure a flow that creates a document group from a template and generates an embedded signing link for a document group recipient. A screen element will display the URL from the Salesforce record.

This flow uses four Apex Actions:

- Create SignNow Document Group from SignNow Template
- Get SignNow Document Group Recipients
- Create SignNow Embedded Invite
- Get SignNow Embedded Signing Session URL

> This example uses a simplified setup for demonstration purposes. Feel free to adapt the flow type and integration logic to your specific requirements.

## Prerequisites

- Go to **Setup** > **Flows** > **New Flow.**
- Select **Screen Automations > Screen Flow**.

![get_dg_flow_type.png](/reference-assets/images/SignNow_Salesforce/apex_actions_2/get_dg_flow_type.png)

## Step 1. Add the Create SignNow Document Group from SignNow Template action

- Click the **+** icon to add the **Create SignNow Document Group from SignNow Template** action to the flow.
- Add a label.
- Set input values:
    - **SignNow Document Group Template ID**: The ID of the document group template used for creating a new document group.
    - **Record ID (optional)**: Salesforce record ID where the new document group is generated. Enter a value or select a resource.
    - **SignNow Document Flow ID (optional):** The ID of the pre-configured Document Flow. If the Document Flow is added, the document group will open with pre-configured settings.
    - **SignNow Document Group Name (optional)**: The name for the new document group.
        - Note: If `SignNow Document Group Name` is blank, the default name is `Document Group DD-MM-YYYY`.
    - **SignNow Folder ID (optional):** The ID of the folder where the document group will be stored.

![apex_create_dg_action_1.png](/reference-assets/images/SignNow_Salesforce/apex_actions_3/apex_create_dg_action_1.png)

## Step 2. Add the Get SignNow Document Group Recipients action

- Click the **+** icon to add the **Get SignNow Document Group Recipients** action to the flow.
- Add a label.
- Set input values:
    - **SignNow Document Group ID:** Select **Outputs from** `Create SignNow Document Group from SignNow Template` action > `SignNow Document Group ID`.

![apex_get_recipients_action_2.png](/reference-assets/images/SignNow_Salesforce/apex_actions_3/apex_get_recipients_action_2.png)

The output of the action is the SignNow Embedded Invites - array of objects that include order of signing and settings for each recipient.

## Step 3. Add the **Create SignNow Embedded Invite action**

- Click the **+** icon to add the **Create SignNow Embedded Invite** action to the flow.
- Add a label.
- Set input values:
    - **SignNow Document Group ID**: Select **Outputs from** `Create SignNow Document Group from SignNow Template` action > `SignNow Document Group ID`.
    - **SignNow Embedded Invites:** Select **Outputs from** `Get SignNow Document Group Recipients` action > `SignNow Embedded Invite`.


![apex_create_embedded_invite_action_3.png](/reference-assets/images/SignNow_Salesforce/apex_actions_3/apex_create_embedded_invite_action_3.png)

## Step 4. Add the **Get SignNow Embedded Signing Session URL action**

- Click the **+** icon to add the **Get SignNow Embedded Signing Session URL** action to the flow.
- Add a label.
- Set input values:
    - **Email:** Enter a recipient email. You can use a value or select a resource.
    - **SignNow Document Group ID:** Select **Outputs from** `Create SignNow Document Group from SignNow Template` action > `SignNow Document Group ID`.
    - **SignNow Embedded Invite ID:** Select **Outputs from** `Create SignNow Embedded Invite` action > `SignNow Embedded Invite ID`.


![apex_get_embedded_invite_link_action_4.png](/reference-assets/images/SignNow_Salesforce/apex_actions_3/apex_get_embedded_invite_link_action_4.png)

## Step 5. Add a screen element

Add a screen to display the generated link for the document group.

- Click the **+** icon below the SignNow action and select **Screen**.
- Add a label.
- In the **Components** panel on the left, select **URL**.
- Add an API name.
- In the **Value** field, select `Outputs from Get_SignNow_Embedded_Signing_Session_URL` > `SignNow Editor URL` > `SignNow Embedded Signing Session URL`.

![apex_screen_embedded_link_5.png](/reference-assets/images/SignNow_Salesforce/apex_actions_3/apex_screen_embedded_link_5.png)

- Click **Done** to save screen settings.

## Step 6. Finalize the flow

- Click **Save**.
- **Activate** the flow.

## **Step 7. Create a flow action and add it to the object layout**

Finally, [create an action](/docs/add-action-page-layout) that will show the screen with the embedded signing URL for the new document group.

## **Result**

Users can now click the action button you have created on the Salesforce object to generate a document group and obtain the link to edit it. The link can be embedded in an iframe using a Lightning Web Component (LWC) that wraps the standard HTML tag or email template you use.

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


---
*Full page: https://docs.signnow.com/docs/apex-create-document-group-from-template*
