Automatic DocuSign Workflows

The native DocuSign integration with Anaplan makes it simple to share information between Anaplan and Docusign, but the process to issue envelopes or track changes back in Anaplan can sometimes be quite manual and time-consuming as envelope counts begin to increase. 

This article will walk through a script to automate this process. This solution requires Python (written for 3.8) and ChromeDriver, a tool for automating web UI interfaces. Although written in Python, this script is quite simple to maintain, only requiring that you update the Anaplan and DocuSign passwords when they change. All of the user-relevant variables are found at the top of the script:

User VariablesUser Variables

Here you can see the following variables:

  • chromedriver_location: The path where you downloaded Chromedriver.
  • username: Your Anaplan username.
  • password: Your Anaplan password.
  • docusign_username: The Docusign account that has access to the envelopes you're sending.
  • docusign_password: Your Docusign password.
  • workspace: The name of the workspace of your Anaplan model.
  • model: The name of your Anaplan model that contains your Docusign details.
  • search_terms: The names of the Docusign workflows you wish to update.
  • date_range: Here you can define how far back the script will look when updating workflow status. The initial value is for 31 days.

The first step for the script is to open an incognito instance of Chrome to avoid any caching issues, and then log into Anaplan. Then, open the DocuSign add-on.

Screenshot 2020-07-02 at 12.02.30.png

Occasionally, the browser will redirect to the DocuSign login page. After initially opening the add-on page, the script waits for a few seconds, then detects whether the DocuSign login is detected. If not, it enters the workspace and model details you provided and brings you to the landing page for the add-on.

Next, the script opens the workflows pane, clicks into the workflows you defined in search_terms, and sends updates, if any exist. This will check whether there are any unsent messages for the defined workflows and send them out.

Screenshot 2020-07-02 at 12.10.23.png

Here, you'll see some long sleep times where we're telling the script to wait for some number of seconds before proceeding. This is to ensure that the page has fully rendered and all buttons are clickable. Since this is an unattended script, I decided to invest time in finding the optimal time to wait in order to get execution time as fast as possible. I also wanted to have a sufficient window to handle unexpected slowness in the network.

Finally, after all workflows are updated, the script moves onto sending updates back to Anaplan. It searches for the workflow name, then gets the total number of items for that workflow. Here it loops, clicking into each item for your search term, and sending an update back to Anaplan.

Screenshot 2020-07-02 at 12.16.34.png

This is also where the script reads the sent date of each item it finds, and if that date is within the window you defined in User Variables, it clicks into that item to send updates back to Anaplan. This means the script isn't spending time trying to update items that are weeks, months, or years old.

Finally, once all items in all search terms are updated the script reports back how many items it updated to Anaplan.

Comments

  • Hi Wilson,

    Very informative and interesting on this solution.

    Currently we also looking similar kind of solution like refresh very frequently like 5min. The default refresh time is 30min, but our customer is looking for earlier than this.

    Is it possible to share the sample script and end to end setup document on this?

    So that I will implement the same.

    Thank you and kind regards,

    Anil

  • hari.prasad
    edited February 2023

    Anil,

    Using this automation script (as mentioned in this article) is not recommended as it requires maintenance against the product updates.

    If the customer want to run this frequently, i.e. earlier than 30 mins, then request them to handle it manually. Or you can share the use case that demands customer to run this refresh earlier, with data integration team and request them to consider to schedule it earlier.

    Hari Prasad M

  • Hi Hari,

    Thank you so much for your reply.

    Actually 30min refresh is considered as reasonable time as this solutions involves email exchanges. But some times customer may expect at least 15 or 20min as per their requirement.

    I will discuss internally regarding to share the use case.

    Thanks once again and best regards,

    Anil