This is my first post. I have learned almost everything I know about Apps Script from these forums, so thank you in advance.
I am trying to create a prefilled Google Form based on previous submissions. Data is passed to the Form as a string.
function filledFormGenerate(str){
var dataarr = str.split('♠');
var form = FormApp.openById("FORMID");
var formResponse = form.createResponse();
var items = form.getItems()
var choices = items[0].asMultipleChoiceItem().getChoices()
var formitem = items[0].asMultipleChoiceItem()
var response = formitem.createResponse(choices[0].getValue());
formResponse.withItemResponse(response);
response = items[7].asTextItem().createResponse(dataarr[3].toString())
formResponse.withItemResponse(response);
var url = formResponse.toPrefilledUrl();
var html = '<html><body><a href="'+url+'" target="blank" onclick="google.script.host.close()">'+'Follow this link to submit your next form.'+'</a></body></html>';
var relinkui = HtmlService.createHtmlOutput(html)
var ui = SpreadsheetApp.getUi();
ui.showModelessDialog(relinkui, "Relinking Form")
}
With my own account, this is fully successful, but other users get the following Error on trying to access the form URL:
Exception: No item with the given ID could be found. Possibly because you have not edited this item or you do not have permission to access it.
Short of making the form editable by all users, is there a set of permissions to make this happen?
Thanks