Prepare the response sheet
Open a practice Google Form and link its responses to a spreadsheet. In the response tab, add a column named Ticket ID to the right of the last form question. Leave its cells blank. Reserve that heading for the script. If your response tab has another name, replace Form Responses 1 in the snippet with its exact name.
From the spreadsheet, choose Extensions → Apps Script and paste the code. In Triggers, add a trigger for assignSequentialId, choose From spreadsheet and On form submit, and authorize it. Send a response through the form to supply an event. Running the handler directly from the editor leaves e undefined.