Coding level: Beginner
Duration: 10 minutes
Project type: Automation with an
event-driven trigger
and a time-driven trigger
Objectives
- Understand what the solution does.
- Understand what the Apps Script services do within the solution.
- Set up the script.
- Run the script.
About this solution
New employees usually require system access and equipment from IT. To manage these requests, you can create a form with Google Forms for users to indicate what access and devices employees need. Once IT completes the request and updates its status, requesters receive an email notification.
How it works
The script creates an equipment request form. You can customize the items on the form in the sample script's code. When someone submits the form, the script sends an email notification to the designated point of contact for requests. Once the request status in the spreadsheet is changed to "Completed," the script sends a confirmation email to the person who submitted the form.
Apps Script services
This solution uses the following services:
- Forms service–Creates the form for IT requests.
- Spreadsheet service–Checks to see if the request form already exists to mitigate duplicates. Manages the form responses by moving them to the Pending and Completed sheets as needed.
- Mail service–Creates and sends the request and completion notification emails.
- Script service–Creates the triggers. One fires when a form is submitted and the other fires every five minutes to check if a request's status is marked as "Completed."
Prerequisites
To use this sample, you need the following prerequisites:
- A Google Account (Google Workspace accounts might require administrator approval).
- A web browser with access to the internet.
Set up the script
Create the Apps Script project
- Click the following button to make a copy of the Manage employee equipment
requests spreadsheet. The Apps Script project for this
solution is attached to the spreadsheet.
Make a copy - Click Extensions > Apps Script.
- Next to the
REQUEST_NOTIFICATION_EMAIL
variable, replace the sample email with your email. - Click Save .
Set up the spreadsheet
- Return to the spreadsheet and click Equipment requests > Set up. You might need to refresh the page for this custom menu to appear.
When prompted, authorize the script. If the OAuth consent screen displays the warning, This app isn't verified, continue by selecting Advanced > Go to {Project Name} (unsafe).
Click Equipment requests > Set up again.
Run the script
- Click Tools > Manage form > Go to live form.
- Fill out and submit the form.
- Check your email for a notification about the equipment request.
- Return to the spreadsheet and on the Pending requests sheet, change the status of the request to Completed.
- Within 5 minutes, the script sends another email notifying you that the request has been completed. The script moves the request from the Pending requests sheet to the Completed requests sheet.
Review the code
To review the Apps Script code for this solution, click View source code below:
View source code
Code.gs
new-equipment-request.html
request-complete.html
Contributors
This sample is maintained by Google with the help of Google Developer Experts.