Documentation

{{docApp.title}}

{{docApp.description}}

How can we help?

{{docApp.searchError}}
{{product.name}}

Searching in {{docApp.searchFilterBySpecificBookTitle}}

{{docApp.searchResultFilteredItems.length}} results for: {{docApp.currentResultsSearchText}} in {{docApp.searchFilterBySpecificBookTitle}}
Search results have been limited. There are a total of {{docApp.searchResponse.totalResultsAvailable}} matches.

You have an odd number of " characters in your search terms - each one needs closing with a matching " character!

{{docApp.libraryHomeViewProduct.title || docApp.libraryHomeViewProduct.id}}

{{docApp.libraryHomeViewProduct.description}}

  1. {{book.title}}

{{group.title || group.id}}

{{group.description}}

  1. {{book.title}}

{{group.title}}

Google Forms

The Google Forms integration allows you to interact with the Service Manager app by allowing Google Forms to create new requests or update existing requests using the Google Forms questions and storing the answers back into a request’s custom fields.

At a Glance

Update an Existing Request

The following steps will be used to allow for a Google Form link to be sent via email from an existing request using either the BPM Workflow or an Auto Task.

  1. Set up an API Key.
  2. Create your Google Form.
  3. Adding the integration script.
  4. Customizing the integration script.
  5. Add a trigger.
  6. Create a pre-filled link.
  7. Add the pre-filled link to an automated email.

Setup an API Key

The creation of an API Key allows for secure authentication for the Google Forms to interact with Hornbill. The API Key will be used within the Integration Script

  1. Open the Platform configuration.
  2. Navigate to System > Organizational Data > Users.
  3. Select a user that you wish Google Forms to authenticate as. This user will require the rights needed to create and modify requests in Service Manager.
  4. On the User Account, select the API Key tab.
  5. Create a new API Key using the name Google Forms.
  6. Keep this page available to you, as you will need to copy the API Key into the integration script.

Create Your Google Form

This part of the setup requires that you have a Google account.

  1. Open your Internet Browser and navigate to google.com and login with the account you wish to use to create the form.
  2. From the Google Apps menu, find the Forms app and select to open.
  3. Under the Start a New Form section, select Blank.
  4. Add a title to your form.
  5. Click on the default question that has been provided.
  6. Change Untitled Question to Request Reference. This first question will be used to hold the Request ID that it is linked with and will be prepopulated (Create a Pre-filled Link).
  7. Change the question type to Short Answer.
  8. At this point, you can optionally add more questions, but it is not required. Additional questions will be covered in Map Questions to Custom Fields.
  9. Keep this browser tab open as you need it in the next step.

Adding the Integration Script

This section will take you through taking the provided example script and adding it to your Google Form.

  1. View the Example Script that is provided on GitHub (Use CTRL key to open in a new tab).
  2. Copy the entire contents of the script by clicking on the Copy Raw Contents button.
  3. View the browser tab where your Google Form is located.
  4. Click on the More Menu (vertical ellipse button next to your profile picture) and select Script.
  5. Click on Untitled Project and give your project a name.
  6. Delete all of the default text in the code.gs window so you have a blank space.
  7. Paste the text that was copied from the Example Script.
  8. Save the script.

Customizing the Integration Script

Authentication

At the top of the script there are 2 key lines that needed editing.

Google Forms Authentication

  • var apiKey = ‘yourapikey’;
    The text yourapikey needs to be replaced with the key that we generated in the section: Setup an API Key. Be sure to keep the quotation marks.

  • var instanceId = ‘yourinstanceid’;
    The text ‘yourinstanceid’ needs to be replaced with your instance ID. This can be found within the URL that connects you to your Hornbill. This should be all lowercase. Be sure to keep the quotation marks.

Request Reference

In the section Create Your Google Form you will have added your first question to your form. This question, titled Request Reference is the link between this form and an existing request in Service Manager. If you wish to have a different title than Request Reference you will need to update the following line of code to match the title of the question.

Request Reference

  • itemResponses[i].getItem().getTitle() === “Request Reference”
    Make sure that the text Request Reference matches the title of the question in the form that will hold the reference ID.

Questions and Custom Fields

Each question that you add to a Google Form can be mapped to a request’s custom field. The script uses a case statement to identify the Form question using its title and then maps it to a custom field where the response will be stored.

Custom Fields

In this example, there are three questions

  • Address. A question that has the title Address will be added to the custom field h_custom_d
  • Contact. A question that has the title Contact will be added to the custom field h_custom_e
  • Date Of Birth. A question that has the title Date Of Birth will be added to the custom field h_custom_f

You can add, remove, rename, each case statement and choose your custom fields to match your Form questions and where you would like the responses to be stored.

Update Status

Update Status

The Update Status function provides two updates that can be made to a request.

  • Status. The default in this script is set to Open. Options can include New, Open, Resolved, and Closed.
  • Update Timeline. A Timeline entry will be added to a request once the Form has been submitted. Here you can change the text that will be displayed in the Timeline of the request

Add a Trigger

Triggers are created to specify what happens when someone finishes and submits a form. The trigger will link to the functions within the newly created script.

  1. On the left vertical menu bar, click on the clock, which will open the Triggers page.
  2. Click on + Add Trigger (bottom right).
  3. Under the option _Choose which function to run, make sure that OnSubmit is selected.
  4. Unser Select Event Type, make sure that On form submit is selected.
  5. Click Save.
  6. You may be presented with a dialog box asking you to select your Google account.
  7. You may be presented with a warning message saying that Google hasn’t verified this app. Click Advanced, and then at the bottom select Go to project (unsafe).
  8. You may be presented with a dialog box saying your project wants to access your Google Account. Scroll to the bottom and select Allow.
  9. You may receive a Security Alert email in your Google mailbox.
  10. Click Save again.
In This Document