You don’t need a trigger if its your own webapp, just use the webapp code to do what functions you wanted the sheet trigger to do.
--
You received this message because you are subscribed to the Google Groups "Google Apps Script Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-apps-script-c...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/1438fef5-8dd8-42cf-8a9f-13f95fd67b99n%40googlegroups.com.
Show us your webapp code and will let you know.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f2f86014-7ae8-4509-bbd4-864c04e799b3n%40googlegroups.com.
Ok from what I can see, your function addRows is the one that injects the data into the spreadsheet.
function addRows(obj){
let sheetName = ss.getSheetByName('Data');
var rndNum= getRndNumber(1, 999);
var id = ('000' + rndNum).slice(-3);
let uid = 'FUJI' + id;
…
So what you need to do is inside addRows, make a call to your function inside the spreadsheet to send the notification. To do that, get the script Id of the script contained in the spreadsheet, then add that script as a Library to your webapp.
Once you have added that script as a library to your webapp (you can call your autoreply function directly at the bottom of addRows function.
Calling a library function is done this way:
libraryName.autoReply();
libraryName is whatever Google name you gave your script, but you can also change it when you add the library
Hope that helps.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/6e48ab60-3bad-419e-9eff-fb69600510e7n%40googlegroups.com.
Not sure how to get the script id from code share. That is something you get from the Google AppsScript Editor.
Click on the setting button (gear) and then look for the ID shown in below:
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/95b75a55-02c2-4a49-a56b-3d1258fd4834n%40googlegroups.com.
Check attached screenshot. Click on the + beside library (this needs to be done from where your webapp is being edited. After you click the + enter the script Id and click lookup, it should find it, then you can type in the name of the library you want to use in the coding and then click add.
After you have added the library, you can then add that one line of code at bottom of addRows () but before the return statement!!
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/d141d9aa-aee1-43c1-baaf-e8588edf3392n%40googlegroups.com.
Yes, that is not how it is to be called.
Just add this:
ordersystemrelease.autoReply();
inside the addRows function before the return true; statement.
Also, make sure you republish the webapp for this to take effect.
From: google-apps-sc...@googlegroups.com <google-apps-sc...@googlegroups.com> On Behalf Of nagastar
Sent: Thursday, March 9, 2023 10:11 PM
To: Google Apps Script Community <google-apps-sc...@googlegroups.com>
Subject: Re: [Apps-Script] onformsubmit trigger does not work when using web app forms
I have added a script id to the library with the name ordersystemrelease.
I added the script ordersystemrelease.autoReply
I added the autoreply fucntion script underneath. but it's not running yet. is there something wrong?
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/331a4e82-88b5-4004-b2e1-6a14e9be5d09n%40googlegroups.com.
You are welcome.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/f5570c2f-a55e-437f-8702-86810d28f786n%40googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-apps-script-community/e53b82d9-efef-40db-bf8e-b66b54222927n%40googlegroups.com.