How do we prevent automatically generated Forms from being generated while restricting users to organization?

91 views
Skip to first unread message

Google Apps Script Community

unread,
Nov 3, 2021, 4:30:23 PM11/3/21
to Google Apps Script Community
I have a little script creating submission forms pasted below. The forms that are produced come out with the setting to "restrict to users in (company name) and its trusted organizations)" enabled.

Is there something I can add to this script to make them come out with that setting disabled?

Thank you for your time!


function myFunction() {
//constants for testing
let campaignName = "Campaign Name";
let p1 = "Primary Product"
let p2 = "First Paired Product"
let p3 = "Second Paired Product"

var form = FormApp.create(campaignName + ' Stop Order Form');
var formID = form.getId();

const generatedForm = FormApp.openById(formID);

generatedForm.setTitle('Stop Order Form for ' + campaignName);

generatedForm.setConfirmationMessage("We appreciate your effort to ensure all customers are taken care of. Thank you for making this submission!")

var productMultiChoice = form.addMultipleChoiceItem();
var productMultiChoiceID = productMultiChoice.getId();
productMultiChoice.setTitle('Please choose the product that needs a Stop Order')
productMultiChoice.setChoices([
productMultiChoice.createChoice(p1),
productMultiChoice.createChoice(p2),
productMultiChoice.createChoice(p3)
]);
Logger.log('Published URL: ' + form.getPublishedUrl());
Logger.log('Editor URL: ' + form.getEditUrl());

var longURL = form.getPublishedUrl();
var shortURL = form.shortenFormUrl(longURL);

var ss = SpreadsheetApp.create('Stop Order Requests for ' + campaignName);

generatedForm.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());

Brett Grear

unread,
Nov 4, 2021, 6:27:36 AM11/4/21
to Google Apps Script Community
form.setRequireLogin(false)
should do the trick

Cuneiform Script

unread,
Oct 1, 2022, 10:49:08 AMOct 1
to Google Apps Script Community
Thank you, that is what I'm looking for
Reply all
Reply to author
Forward
0 new messages