Skip to content
Omniscript, Omnistudio

OmniScript Address Autocomplete with Google Places Api

July 8, 2025

In this article we will learn OmniScript Address Autocomplete with Google Places Api. This document provides a step-by-step guide to configure Salesforce OmniScript’s built-in Type Ahead element to perform address autocomplete using the Google Maps Places API. With no Integration Procedures or Apex code, you will: supply your API key, configure the Type Ahead block, and map address components into Street, City, Postal Code, Province/State, and Country fields.

Prerequisites for OmniScript Address Autocomplete with Google Places Api

Before you begin, make sure you have the following:

  • Google Cloud Account: You need an active Google Cloud project with billing enabled.

Obtain Your Google Places API Key

  1. Sign in to the Google Cloud Console.
  2. Select an existing project or click New Project to create one.
  3. In the left menu, navigate to APIs & Services → Library, search for Places API, and click Enable.
  4. Go to APIs & Services → Credentials and click Create Credentials → API key.
  5. In the API key created dialog, give the key a name (e.g., OmniScriptPlacesKey).
  6. Click Restrict key, under Key restrictions choose HTTP referrers (web sites) or IP addresses as needed, then under API restrictions select Restrict key → Places API → Save.
  7. Copy the generated API key—you’ll paste it into the Type Ahead block.

1. Add a New OmniScript Step

1. Navigate to OmniStudio → OmniScripts in your Salesforce org.

2. Open your existing OmniScript or create a new one.

3. Click + to add a Step, and label it Enter Address.

2. Lay Out the Address Fields

1. Inside the Enter Address step, drag in a Type Ahead element for user input.

2. Below the Type Ahead, add five Text elements, labeled as follows:

   – Street

   – City

   – Postal-Code

   – Province / State

   – Country

3. (Optional) Use a Line Break element between rows for clean spacing.
OmniScript Address Autocomplete with Google Places Api1

3. Configure the Type Ahead Block

1. Select the Type Ahead element, then switch to the Properties tab.

2. Expand Google Maps Autocomplete and configure:

   – Hide Map: ☑ (if you do not need the embedded map)

   – Google Maps API Key: <YOUR_GOOGLE_PLACES_API_KEY>

   – Country Filter: (Optional) specify a country code (e.g., US, CA) or leave as All.

OmniScript Address Autocomplete with Google Places Api2

3. Under Google Maps Transformation, click Add for each component and map as follows:


Label

Google Response Path

Street

street

City

address_components:locality

Postal-Code

address_components:postal_cod
Province /State
address_components:administrative_area_level_1           

Country

address_components:country                               

> Each mapping will automatically extract the .long_name field for you.

Also Read: How to pass Data from Omniscript to Custom LWC?

OmniScript Address Autocomplete with Google Places Api3

4. Bind the Selection Output

1. In the Properties panel under Build, locate Selection Variable and name it SelectedAddress.

2. This variable now holds the JSON payload returned when a user selects an address suggestion.

5. Map Address Components via Transformation

Since you’ve configured the Google Maps Transformation on the Type Ahead block, each downstream Text input will receive its value directly without needing separate JSON Path mappings. To ensure correct binding:

1. Edit each Text element and verify its Element Name in the Build tab matches the corresponding Child Element above.

2. Save your OmniScript—no additional JSON Path is required on the Text inputs.

6. Test & Validate

1. Click Preview on your OmniScript.

OmniScript Address Autocomplete with Google Places Api4

2. In the Enter Address step, begin typing an address (e.g., “1600 Amphitheatre Parkway”).

3. Select a suggestion from the dropdown.

OmniScript Address Autocomplete with Google Places Api5

4. Verify that the Street, City, Postal-Code, Province/State, and Country fields populate correctly.

OmniScript Address Autocomplete with Google Places Api6

5. Test edge cases (invalid inputs, unsupported countries) to ensure graceful handling (e.g., clear fields or display “No results”).

7. Tips & Next Steps

– Styling: Apply CSS classes on Text elements to fine-tune alignment and spacing.

– Country Restriction: Set the Country Filter to your primary region to minimize API usage and improve relevance.

– Additional Components: Add further mappings (e.g., neighborhood, sublocality) by repeating the mapping steps.

– Error Handling: Use a Conditional Element to display a custom message when %SelectedAddress% is empty.

Conclusion: OmniScript Address Autocomplete with Google Places Api

By leveraging OmniScript’s native Type Ahead block, you enable full address autocomplete capabilities with minimal configuration and zero code. This declarative approach speeds development, reduces maintenance, and delivers a superior user experience.

Feel free to insert screenshots in place of placeholders, and update variable names to match your org’s conventions. Let me know if you need further enhancements or styling guidance!

Keep Reading

Related Articles and Resources

Getting Started with Salesforce FlexCards: A Beginner’s Guide
July 5, 2025

Getting Started with Salesforce FlexCards: A Beginner’s Guide

Salesforce OmniStudio offers a range of tools that allow...

How to Call Integration Procedure and Data Mapper from Apex Class?
December 11, 2025

How to Call Integration Procedure and Data Mapper from Apex Class?

One of the most powerful aspects of OmniStudio in...

Using Datatable in Omniscript and pass data from OS to flexcard
November 9, 2024

Using Datatable in Omniscript and pass data from OS to flexcard

This blog will cover how data pass from Omniscript to...

Best Practices To Follow for Omnistudio Omniscript
June 11, 2025

Best Practices To Follow for Omnistudio Omniscript

Are you looking for the Best Practices To Follow for...

How to use date time input in omniscript salesforce?
September 24, 2025

How to use date time input in omniscript salesforce?

In this tutorial, we’ll walk through a powerful OmniScript...

AI-Powered Public Sector Services: Turning PSS Workflows Into Autonomous Agents
February 3, 2026

AI-Powered Public Sector Services: Turning PSS Workflows Into Autonomous Agents

For the last two decades, the government has been engaged...