-
Notifications
You must be signed in to change notification settings - Fork 0
/
on_submit.gs
26 lines (25 loc) · 987 Bytes
/
on_submit.gs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/**
* This script should be attached to the original template form
* that is copied for each event.
* Requires a Script Property set with the key 'BNCServiceURLEndpoint'
* and the value of the endpoint for the running service.
*
* Sadly, it requires some manual work when copied:
* You must go to Resources > Current Project Triggers,
* set up an onSubmit trigger to trigger the function onSubmit(e).
* This requires clicking Allow on the oAuth popup.
*
* Requires the following scope to be authorized:
* https://www.googleapis.com/auth/forms
*/
function onSubmit(e) {
var form = FormApp.getActiveForm();
var formId = form.getId();
var properties = PropertiesService.getScriptProperties();
var endpoint = properties.getProperty('BNCServiceURLEndpoint');
var url = endpoint + '?formId=' + formId;
Logger.log("Requesting URL: %s", url);
var response = UrlFetchApp.fetch(url);
var status = response.getResponseCode();
Logger.log("Status Code: %s", status);
}