Scenario
Basic support ticket clone:
- Users submit a form (e.g. answering fault reporting questions)
- Data is obviously stored as rows in the corresponding spreadsheet
- I've added an onEvent trigger to send email onFormSubmit
- Admin checks spreadsheet and updates additional Status column to "Closed" when the job is done
Question
I want to add a step 5 to the scenario where the user who submitted the fault and the department responsible (both emails addresses stored in the row) get a reply when the Status column is updated to "Closed".
I can add the onEdit event which will send an email, but I can't
- Get the active row
- Get the emails from that row (so I send an email to only relevant addresses)
- Trigger onEdit ONLY when the Status column is changed
Best Answer
Have an additional column, "flag" (leave it blank). Now, in your onEdit event:
SpreadsheetApp.getActiveSheet().getDataRange().getValues()
)Now, for each row, do the following:
Find the email cell in that row (you know the column number), send the emails
That's it :)