Blog
Home/

Conditional Recipients

Jonathan Sammons
Jonathan SammonsDeveloper Support Engineer
Summary3 min read

Discover the benefits of Advanced Recipient Routing and get a code example of routing based on the value of a radio button.

    • Advanced Recipient Routing
    • Code example
    • Obtaining the feature
    • Additional resources

    Table of contents

    Advanced Recipient Routing

    Docusign offers two different ways to control your workflows, either by pausing the workflow or by allowing you to automatically have your envelope recipients chosen based on criteria specified in the envelope. For example, if you have a sales contract that needs to route to a certain team based on the amount being purchased, you can have Advanced Recipient Routing logic set up to check for the amount and route to the correct recipient based on the amount being purchased. This enables you to create complex workflows where the next recipient is determined based on data in the envelope that needs to be filled in by an earlier signer.

    In this code example, I’ll be showing you specifically how to use the conditional recipient feature. The scenario that I’m showing is where, depending on the radio button selected by the initial signer, the envelope then routes to either a boat sales team or a car sales team. If you would like to use this example, you’ll need to add your own Base64 document to the call. In my example, I’m just placing the two radio buttons near the top-left corner of the first document by defining the x and y axis for both buttons—you can customize this in your code if you wish by updating the axis or changing the tabs to look for anchor strings.

    Code example

    {
        "status": "sent",
        "documents": [
            {
                "documentId": "1",
                "name": "TestDocument.docx",
                "fileExtension": "docx",
                "documentBase64": "base64 document"
            }
        ],
        "recipients": {
            "signers": [
                {
                    "name": "John Doe",
                    "email": "john.doe@example.com",
                    "recipientId": "1",
                    "tabs": {
                        "signHereTabs": [
                            {
                                "xPosition": "25",
                                "yPosition": "50",
                                "documentId": "1",
                                "pageNumber": "1"
                            }
                        ],
                        "radioGroupTabs": [
                            {
                                "tabLabel": "Sales Radio Group",
                                "groupName": "Sales Radio",
                                "recipientId": "1",
                                "documentId": "1",
                                "radios": [
                                    {
                                        "tabLabel": "Sales Radio Group",
                                        "groupName": "Sales Radio",
                                        "required": true,
                                        "selected": false,
                                        "value": "Boat",
                                        "recipientId": "1",
                                        "pageNumber": 1,
                                        "documentId": "1",
                                        "xPosition": 50,
                                        "yPosition": 125
                                    },
                                    {
                                        "tabLabel": "Sales Radio Group",
                                        "groupName": "Sales Radio",
                                        "required": true,
                                        "selected": false,
                                        "value": "Car",
                                        "recipientId": "1",
                                        "pageNumber": 1,
                                        "documentId": "1",
                                        "xPosition": 75,
                                        "yPosition": 125
                                    }
                                ]
                            }
                        ]
                    }
                },
                {
                    "name": "Sales Department",
                    "email": "placeholder@placeholder.com",
                    "roleName": "Sales Department",
                    "routingOrder": 2,
                    "deliveryMethod": "email",
                    "recipientId": "2"
                }
            ]
        },
        "workflow": {
            "workflowSteps": [
                {
                    "action": "pause_before",
                    "triggerOnItem": "routing_order",
                    "itemId": 2,
                    "status": "pending",
                    "recipientRouting": {
                        "rules": {
                            "conditionalRecipients": [
                                {
                                    "recipientId": "2",
                                    "recipientGroup": {
                                        "groupName": "Sales Department",
                                        "recipientId": "2",
                                        "routingOrder": 2,
                                        "recipients": [
                                            {
                                                "recipientId": "2",
                                                "name": "Boat Salesman",
                                                "email": "boat.sales@example.com",
                                                "roleName": "Boat Sales",
                                                "recipientLabel": "Boat_Salesman"
                                            },
                                            {
                                                "recipientId": "2",
                                                "name": "Car Salesman",
                                                "email": "car.sales@example.com",
                                                "roleName": "Car Sales",
                                                "recipientLabel": "Car_Salesman"
                                            }
                                        ]
                                    },
                                    "conditions": [
                                        {
                                            "order": "1",
                                            "recipientLabel": "Boat_Salesman",
                                            "filters": [
                                                {
                                                    "scope": "tabs",
                                                    "tabLabel": "Sales Radio",
                                                    "recipientId": "1",
                                                    "tabType": "RadioGroup",
                                                    "operator": "Equals",
                                                    "value": "Boat"
                                                }
                                            ]
                                        },
                                        {
                                            "order": "2",
                                            "recipientLabel": "Car_Salesman",
                                            "filters": [
                                                {
                                                    "scope": "tabs",
                                                    "tabLabel": "Sales Radio",
                                                    "recipientId": "1",
                                                    "tabType": "RadioGroup",
                                                    "operator": "Equals",
                                                    "value": "Car"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            ]
                        }
                    }
                }
            ]
        }
    }
    

    Obtaining the feature

    If you would like to obtain access to Advanced Recipient Routing on your account, please reach out to the Docusign support team or your account manager and request access, there’s no cost to use this feature on a development account.

    Additional resources

    Jonathan Sammons
    Jonathan SammonsDeveloper Support Engineer

    Jonathan Sammons is a Docusign Developer Support Engineer based in the Dublin, Ireland office who has a passion for new technologies. He’s been with Docusign for over 8 years in various support roles.

    More posts from this author

    Related posts

    • Developers

      Breaking the Language Barrier: Why Large Language Models Need Open Text Formats

      Dan Selman
      Dan Selman
    • Understanding Levenshtein Distance: Applications to AI-Generated Text

      Vincent Pan
      Vincent Pan
    • Paige Rossi
      Paige Rossi

    Breaking the Language Barrier: Why Large Language Models Need Open Text Formats

    Dan Selman
    Dan Selman

    Understanding Levenshtein Distance: Applications to AI-Generated Text

    Vincent Pan
    Vincent Pan
    Paige Rossi
    Paige Rossi

    Discover what's new with Docusign IAM or start with eSignature for free

    Explore Docusign IAMTry eSignature for Free
    Person smiling while presenting