How to create a Jira ticket on Google form submision

How to create a Jira ticket on Google form submision

Using Appsscript, you can create an integration to connect Jira and Google Form.

To create a Jira ticket upon Google Form submission using Google Apps Script, you will need to:

  1. Create a Google Form and set up the form responses to be saved to a Google Sheets file.
  2. Create a new Google Sheets file and copy the Form responses sheet to this file.
  3. In the Google Sheets file, create a new script by going to “Tools > Script editor”.
  4. In the script editor, add the following code to import the required libraries:
function importLibraries() {
  var libraryUrl = "https://cdn.jsdelivr.net/gh/icodeforlove/jira-connector@gh-pages/dist/jira-connector.min.js";
  return HtmlService.createHtmlOutputFromFile('page').evaluate().setWidth(600).setHeight(450).setSandboxMode(HtmlService.SandboxMode.IFRAME);
}
  1. In the script editor, create a new function that will be called when a form submission is received. This function should do the following:
  • Retrieve the data from the Form submission row in the Google Sheets file.
  • Use the Jira Connector library to create a new Jira issue using the data from the Form submission.
  • Update the Form submission row in the Google Sheets file with the Jira issue ID.
function createJiraIssue(e) {
  // Get the data from the Form submission row
  var sheet = SpreadsheetApp.getActiveSheet();
  var row = e.range.getRow();
  var summary = sheet.getRange(row, 1).getValue();
  var description = sheet.getRange(row, 2).getValue();
  var reporter = sheet.getRange(row, 3).getValue();
  
  // Use the Jira Connector library to create a new Jira issue
  var jira = Jira.createClient({
    host: "your-jira-host.com",
    username: "your-jira-username",
    password: "your-jira-password"
  });
  var newIssue = jira.addNewIssue({
    summary: summary,
    description: description,
    reporter: reporter,
    issuetype: {
      name: "Task"
    }
  });
  
  // Update the Form submission row with the Jira issue ID
  sheet.getRange(row, 4).setValue(newIssue.id);
}

This function does the following:

  1. Retrieves the data from the Form submission row in the Google Sheets file (the summary, description, and reporter).
  2. Uses the Jira Connector library to create a new Jira issue with the data from the Form submission.
  3. Updates the Form submission row in the Google Sheets file with the Jira issue ID.

You will need to replace “your-jira-host.com”, “your-jira-username”, and “your-jira-password” with the hostname, username, and password for your Jira instance.

  1. In the script editor, create a trigger for the function you just created to run when a form submission is received.
  2. Test the integration by submitting a new Form and verifying that a Jira issue was created.