Skip to content

Training request form

Nicole Fenton edited this page Nov 15, 2017 · 3 revisions

The training request form is hosted and managed through a GSA Google Form. It stores responses in an underlying GSA Google Form as well. The form and spreadsheet are owned by DigitalGov, so for editing/admin changes, please coordinate with DigitalGov.

The default behavior of Google Forms is to email a notification to collaborators when someone responds. However, the notification email only contains a link to view the submitted content; the content is not shown in the notification email itself. This is problematic for folks that have Google Apps blocked. In order to have the contents emailed directly to an email or distribution list, we’ve connected a Google Script to the Google Sheet. For reference, here is the script:

function sendFormByEmail(e) {    
  var email = "ENTER EMAIL ADDRESS HERE"; 
  var subject = "New Training Request";  
  var s = SpreadsheetApp.getActiveSheet();
  var headers = s.getRange(1,1,1,s.getLastColumn()).getValues()[0];    
  var message = "";    

  for(var i in headers)
    message += headers[i] + ' = '+ e.namedValues[headers[i]].toString() + "\n\n"; 

  MailApp.sendEmail(email, subject, message); 
}