Why entry IDs are the wrong starting point
The UI trick — open a form in preview, fill it, copy the link, read off ?entry.12345678=value — works once, for one form, manually. The moment you rename a question or duplicate the form, those numeric IDs change silently. Apps Script gives you a cleaner path: FormItem objects that carry the ID internally, so you never touch the raw number.
The key method is toPrefilledUrl(), called on a FormResponse object. That response is never submitted; it is only a data carrier for building the URL. You get it by calling form.createResponse(), attach partial answers with withItemResponse(), and call toPrefilledUrl() at the end. The numeric entry IDs appear in the output URL automatically, derived from the item objects you already hold.