Google-apps-script – “Select Users from organization” field with Google Forms

google-apps-scriptgoogle-forms

I have a Google form that allows users to send a co-worker a digital greeting card but they have to manually enter the email address of the person they are sending it to. The issue is sometimes they might put in john@example.com instead of jonathan@example.com.

I need a check that will make sure the email address that they provide actually exists in the organization.

Whether this takes the form of suggestions as they type the email (like when typing an email in Gmail) or if there is a script to check it after submitting (I could email the user after to let them know they sent it wrong) either way would work, I just need to make sure the emails exist.

Best Answer

Working on the solution:

...a check that will make sure the email address that they provide actually exists in the organization...

We were facing a similar situation. Being an educator we have youngsters that quite often misspell their email accounts when filling out their test forms. As a result we would end up sending their grading to the wrong or even a non-existing email.
We are not script savvy so we came up with a workaround.

Instead of having them fill out their emails, we provide those emails as a dropdown list (taken from a class roster) and all they have to do is choose their own.
Assuming the organization is not a couple hundred people (in which case you most definitely need a script), this could very well work in your case as well. If you were to change the droplist to a checkbox, you could even have someone send a greeting card to more than just one member.

You may argue the above answer as the "right" choice. The reason being it may cause a security breach. In addition to having personal data publicly exposed. In that case you could sent the form by email or even have it password protected.

A scripting solution that could, after submitting the form, compare the answer of a specific question to a given list of emails and take an appropriate action (e.g. sent an email to the form creator for a not-listed email) would indeed be very welcomed by us as well.