Google Shared Drive Integration(s)


Purpose: Display and interact with a list of files on a case that are in the agency's specified Google Shared Drive (formerly Team Drive). There are two versions of this integration.


Google Search Integration: that displays a list of documents that matches 1) either the client's first and last name or the case number or 2) just the case number. This is the original version of our Google Integration.


Google Folder Integration: creates a Google Drive folder and then allows you to store documents in that folder. This is the new version of our Google Integration and is still in Beta.


Cost: $2,200.00 one time setup fee for the Google Search Integration. TBD for the new Google Folder Integration.

Google Workspace Setup


This is required for either style of the Google Shared Drive Integration.


* if you haven't enabled the Google Developer Console, this needs to be enabled first in Google Workspace.


Overview of Setup Steps

    1. Create a "project" in your organization's Google API Console.

    2. Create credentials in this project that LegalServer can use to access your Shared Drive. This will include the creation of a "service account".

    3. Download a file containing the details of the credentials that you have created.

    4. Share your Shared Drive with the service account that you have created.


Detailed Procedure


Create a project in the Google API Console


Navigate to https://console.developers.google.com/apis/dashboard


If you don't have any projects created yet, there will be a blue button "Create Project":

If you do have one or more projects, then you should click on the project name dropdown at the top next to the search bar, and then click "NEW PROJECT" in the popup.

In the "New Project" form, fill out the "Project Name" field, with something like "LegalServer Shared Drive" and click "CREATE".


The creation process isn't immediate. There will be a progress notification in the upper right. Once it says complete, you can click on it to be taken to the new project's dashboard.

Create credentials


The first step in creating credentials is to enable the Google Drive API for your new project. Click on the navigation menu icon (three stacked lines) in the upper left, then click on "APIs & Services" in the sidenav that pops out.

At the top, click "ENABLE APIS AND SERVICES". You'll be taken to a page headed "API Library". In the search box at the top, type "google drive". One of the results will be the "Google Drive API". Click on that item, then click the blue "ENABLE" button.

Create Credentials for the API project


Click on the credentials tab and then click +Create Credentials at the top. Then Select Service Account from the dropdown options.

Select Service Account.


Give it a name and then click continue.


Select the Role for Service Account Token Creator:

Then click “DONE”. (“Grant users access to this service account” is not needed).


Click on the service account name once it has been created. That will take you to the details of the service account.


Then click on the header for "Keys" and click "Add Key" and then "Create New Key".

Select "JSON" as the Key Type.


Download the .json file that contains the credentials you just created.


It will look something like this:

Information from some of these fields will be needed to configure the Shared Drive list view on LegalServer.


Share the Google Shared Drive with the service account email. For example, the drive would need to be shared with "team-drive-test@test-26151.iam.gserviceaccount.com" above.


Google Search Integration Configuration

Google Team Drive Documents Listview

Add the Google Team Drive Documents list view on a profile.


Grab your "Team Drive ID" (which is found at the end of the URL for the Shared Drive) in Google Workspace.


Get the Credentials for the Drive API project you created by opening the .json file you downloaded above.


Note: You may see several '\n' characters in the private key, and those must be manually removed before they are pasted into the list view configuration.


While removing the "\n" characters, do not remove the ----BEGIN PRIVATE KEY---- or -----END PRIVATE KEY----- lines.


Copy and paste your Shared Drive ID into the list view configuration. You can skip the two OAuth fields. And copy and paste the information from each of the fields in the JSON file into the corresponding fields in "Google Drive Configuration" section.

Admins can configure their site to show results that either match the case number only or both the case number or the client's first and last names. By default, the search is more inclusive.


Here is a suggested Instruction element to place above the list view element:

Cut and paste this in the instruction if you find it useful:


<img width="39" alt="Google Drive icon (2020)" src="https://upload.wikimedia.org/wikipedia/commons/thumb/1/12/Google_Drive_icon_%282020%29.svg/128px-Google_Drive_icon_%282020%29.svg.png"><b>GSuite Shared Drive Documents</b> <br> (below are all Shared Drive docs created after the date the case was opened and that contain the First and Last Name of this client OR this case number in the document text or title)


Which displays similar to this on the profile:

Testing

Add a document to your Shared Drive that contains either the first and last name of a client or a case number, then visit that case in LS. The name search looks for one of three options: "First Last", "Last, First" or "First" AND "Last".

To get quicker results, put the name or case number in the file's title/name. There is often a delay with Google's API picking up a file based on content versus the title.


Google Folder Integration Configuration

Settings

Instead of storing the Google Drive Settings on the back end of the Listview, there is now an Admin -> Google Drive Integration Settings page. This is where the settings from Google’s JSON Key file should be should be stored. The last setting on this page is the “Default Google Drive Initial Folder. This should be the unique ID for the folder where you want to create all the Google Drive case folders. This can be overridden by the Create Google Drive Folder block, but the integration needs a default location. When you are looking at a google drive folder in a browser, the url should be something like:


https://drive.google.com/drive/u/0/folders/10YxIjpT_kOWsevodUByKZFXOQtipjhQ9


In this case, the unique ID to put in the field would be 10YxIjpT_kOWsevodUByKZFXOQtipjhQ9. You will also need to add this to the lookup below.


If you want to group your Google Drive Folders based on Office, Program, or some other feature in LegalServer, you can add additional other parent folders to a lookup: Lookups -> Google Drive Initial Folders. Feel free to name that whatever you want and store the appropriate Folder IDs.


Google Drive - Create Case Folder Block


This block can get added to an intake process (after the initial intake form) or an auxiliary process. You have to select a default Google Drive folder from the lookup you previously updated.

In the UI, you will not see anything if the folder does not exist. If the folder already exists, you will get an instruction about it.

The folders created by this block are named “Last, First (22-0000034)”. They can be renamed and moved without breaking the integration since the folder’s Unique ID is stored in LegalServer.


Google Drive Tree View

This is the block that will display the folder itself. There are no settings on the back end.

All but the top subfolder are displayed collapsed. Clicking the “+” icons next to the folder will expand them.

The pencil icon will allow you to rename the file. The Trash icon will delete the file. This takes the file to Google Drive’s Trash folder.


You can also drag and drop documents into other folders or subfolders. You can even drag and drop documents from your desktop. You cannot drag and drop subfolders. Clicking on the blue name of a folder or a file will open the file in a new tab.


Future Expansion

LegalServer will look at storing some documents in Google Drive automatically from Templates, Add Documents, and Case Notes. We are also adding a User Authentication piece so that Google recognizes you as you when you upload or modify a document instead of just using the service account credentials.


Notes, Issues, Questions


Can I connect to multiple Shared Drives?

The answer is that we haven't tested this. You may run into performance or rate limiting issues with Google.


Having multiple Shared Drives linked on a case profile may not work because of credential caching. Having different Shared Drives on different case profile views should work. For example, if you have the list view on the Main Profile connecting to one Shared Drive, but a "DV Case Profile" that connects to a different Shared Drive. In other words, you don't have two instances of the list view on the same profile or profile view.


We welcome feedback on what works, or doesn't, if you try this.