How to identify form completed when using multiple Gforms in Gsheets

7 views
Skip to first unread message

Ian Beirne

unread,
Feb 1, 2023, 8:51:16 AM2/1/23
to Google Apps Script Community
Hello,
I have created several Gforms to capture data from users with different actions to be perfomed on submition. I have tried using the onFormSubmit function and set a trigger,  trying to send the results of each form to the next function for processing , but the reciept of one message triggers both functions as I have not found a way to identify the form.
I have tried setting up a trigger for each form action and both form functions are triggered.
I need to identify which form was completed and trigger an event to transfer data from form response sheet to another sheet.
All videos and discussion on line seems to be for one form and I haven't been able to identify the form used within each trigger.

Can anyone help? 

cwl...@gmail.com

unread,
Feb 2, 2023, 7:32:51 AM2/2/23
to Google Apps Script Community
Hi Ian, 
This simple script got this info. Use the event object "source" to ferret out to form Id. The "source" is the actual form itself.

function onFormSubmit(e) {
  var form = e.source
  console.log(form.getId())
}
Reply all
Reply to author
Forward
0 new messages