How to Automatically Capture a User’s Location on a Form

Use Case

Forms work well for capturing information from any user. Mistakes can happen when entering information that creates more work for you!

For example, let’s say you offer your customers on-site services for the equipment they’ve purchased. You’ve noticed that in the last few requests, the service location has been incorrect for one request, which resulted in your team getting to the customer 2 hours later than expected.

You could set up a new process for verifying service locations, or you could capture those locations automatically. No user input is required.

Here’s what the process would look like for your customer:

<iframe class="tscplayer_inline smart-player-embed-container-iframe embeddedObject" style="overflow: hidden;" src="https://www.screencast.com/users/odalis1280/folders/KB%20Videos/media/2c57e611-a6d7-4298-8a6a-9f8d71ef3bb3/embed" name="tsc_player" width="800" height="465" frameborder="0" scrolling="no" allowfullscreen=""></iframe>

Requirements

You will need an Address field in your table, and it will need to have "Geolocate Records" enabled in order to capture a user's location.

Geolocation and maps are available on the Pro plan and above.

If this is your first time creating an app, you'll need to know some basics about adding tables, fields, pages, and views. You can start by reading our Builder Basics section. 
Other good resources can be found in our About Your Database and Working With Pages article in our knowledge base.

Steps

Select the Page with the Form

In the Pages section of the builder, select the page that holds the form you want to use to capture the user’s location. 

Open the Form Editor

Click on the form on that page to open the editor.

Go to Record Rules

Go to the Rules section of the form editor and then click on the Record Rules option:

Add the Record Rule

Click the “Add Rule” button and use the following settings for your record rule:

  • Action - Update this record

  • When - Leave this blank, unless you only want to capture the location under specific circumstances

  • Values - Set {select your Address field} to the user’s current location

 
Note: This will work for Address fields with either the Address or Latitude/Longitude input type.
 

Notes and Troubleshooting

  • If on mobile, location detection must be enabled on the device.

  • The app must be accessed securely using HTTPS to allow for location detection in the browser.