Screenshot of Google Form to add a Court to GBLS Eviction Defense System.

Do you maintain Hotdocs guided interviews on LHI? Here’s one way to keep a Hotdocs guided interview up to date: use a Google Form to let users across the jurisdiction submit updates to a spreadsheet, and then use Google Apps Script to generate a Hotdocs computation from the user submissions. The computation can be used as a quasi database in your guided interview. It’s not completely automated, but it’s simple to use and free.

My code and example files are on Github.

Why?

I’ve been updating the GBLS Eviction Defense System which was originally built to using a specific Hotdocs technique called an overlay answer file. It’s now hosted by the amazing nonprofit, Law Help Interactive (LHI). Unfortunately, LHI doesn’t support overlay answer files, so I had to hardcode that overlay file into the main interview. A second problem was receiving updates from across the state. I wanted anyone in the state to use the system, but we only had a list of attorneys and courts relevant to Greater Boston.

First, I turned the overlay answer file into a computation, using (of course) a Hotdocs template. I could copy and paste the computation into Hotdocs. Here’s what the output looks like:

I still had a problem for receiving updates to the list of attorneys and courts in the interview. This week, I decided to use a Google Form to let users submit their updates. The benefit is that Forms are very easy to use, and they can enforce a proper data format. I ditched my original Hotdocs template, and created 2 new templates to export the data into CSV files (one each for attorneys and courts). I only had to use these templates once.

Creating the workflow

  1. I created my Google Form and tied it to a new spreadsheet.
  2. I renamed the sheets (“Attorneys” and “Courts”) and imported the CSV files that I made with my Hotdocs template from the overlay answer file.
  3. Within the Google Form, I created a new script (Tools | Script Editor)

  4. I created two files in the script editor: Code.gs and StartPage.html. Feel free to grab these samples for your own use.
  5. Once I have enough rows of data, I can run the script to turn the data into a computation that can be copied into the Hotdocs interview, like this:

How could I use this on my own Hotdocs interview?

If you would like to adapt this for your own use, you will need to touch the code.gs file in a few places.

function processForm

In (1) and (2), you can see I check for the name of the spreadsheet. I run a different function for each sheet: either getHotdocsAttorneysComputation or getHotdocsCourtsComputation. Update this if you add more sheets or sheets with different names.

function getHotdocsCourtsComputation

Both Hotdocs functions follow the same pattern: grabbing the contents of the spreadsheet (1), and then wrapping each column’s value inside a little text (2). In (3) you can also add additional text to the beginning (change value of “text” variable) or the end (change value of “hcText” variable).

Google Apps Script is a subset of JavaScript. What do you need to know to update this if you don’t know JavasScript? The “for” loop iterates through all of the rows in the spreadsheet. You can leave that untouched. The [][] syntax is a two-dimensional array that references a column and row in the spreadsheet. The first dimension is the row (incremented with each iteration of the for loop, represented by the variable “j”) and the second dimension is the column. We need to keep track of which column has our data. Column numbers start with 0. If you’re using a Google Form, column 0 will have a timestamp, so you’ll skip using it in the generated computation.

You should also understand the syntax of the text concatenation. += is the equivalent of Hotdocs’ RESULT +. The + symbol works like Hotdocs’ + to join two strings of text together. The rest is just Hotdocs code.

Finally, the cr variable just adds an HTML carriage return (represented by </br> in HTML) after each line of the computation.

From the user’s point of view

I included a link to the Google Form in the interview itself:

On the Google Form, the user is walked through the data they need to submit to get a new attorney or court added.

Next steps

This is a quick and dirty solution for me, and I think I’m done working on it. A good generalization would generate the computation dynamically, instead of using a static list of columns and Hotdocs script code for each column.

Follow me on social media:

Leave a comment

Your email address will not be published. Required fields are marked *