Using geolocation in Virtual Agent

  • Release version: Yokohama
  • Updated January 30, 2025
  • 2 minutes to read
  • Summarize
    Summarized using AI
    This content was generated using new OpenAI-powered functionality. Results are provided on an as is basis and are not guaranteed to be accurate or complete.

    Summary of Using Geolocation in Virtual Agent

    ServiceNow's Virtual Agent includes a pre-builtGeolocation topic blockthat allows topic authors to retrieve a user's latitude and longitude coordinates during conversations. This feature requires the user's permission and is designed to enhance response efficiency, such as dispatching technicians based on their proximity to a customer site.

    Show full answer Show less

    How Geolocation Works in Virtual Agent

    • When users initiate the Geolocation topic block, they are prompted to share their location.
    • With permission, the Virtual Agent obtains latitude and longitude coordinates from the user's device.
    • Users may encounter operating system or browser prompts to allow or block location sharing, which can vary in frequency.
    • If users decline, the topic block does not retrieve coordinates and returns an error message, which is logged for troubleshooting.

    Customizing the Geolocation Topic Block

    Topic authors and administrators can tailor the Geolocation topic block by duplicating and renaming it to fit specific conversation flows. Customization options include:

    • Editing input mappings to modify permission prompts, including adding explanations or reasons for requesting location data using data pills or scripts.
    • Selecting output mappings to define which variables (latitude, longitude, error messages, status) are returned and stored during conversations.

    At minimum, latitude and longitude should be selected to enable effective location-based responses. Additional outputs like error details assist in diagnosing issues.

    Practical Benefits for ServiceNow Customers

    • Enables faster and more accurate response to customer incidents by identifying technician proximity.
    • Improves Virtual Agent conversations with dynamic location-based data, enhancing user experience and operational efficiency.
    • Allows flexible customization to align with organizational policies and user communication preferences.

    Topic authors can include a pre-built topic block called Geolocation in conversations with users. The Geolocation topic block retrieves the latitude and longitude coordinates of the user's location.

    Topic authors can add this topic block to larger conversation flows. With the user's permission, the topic block retrieves the user's latitude and longitude location coordinates. Knowing these coordinates can help topic authors respond to customer requests or issues faster and more efficiently.

    For example, you may need to send a technician to a customer site to resolve an incident. To quickly respond to the customer, you need to know which technicians are located nearby so you can dispatch the appropriate technician for the customer's location.

    For general information about how geolocation is used on the ServiceNow platform, see Geolocation.

    Share location details

    The first time a user, such as a field technician, uses the Geolocation topic block in a conversation, they are asked if they would like to share details about their location.

    The chatbot asks, "Would you like to share your location?" Choices are No and Yes.

    Table 1. Geolocation topic block flow
    User choice Topic block response
    Yes The topic block sends the user's latitude and longitude coordinates from the server to the user's device.
    If users want to allow the ServiceNow instance to access their location, users may then see operating system-specific or browser-specific prompts. Examples of such prompts include the following:
    • Allow (always)
    • Allow (one time only)
    • Block (don't allow)

    Depending on the user's response, they may see this prompt one or more times, or they may never see it.

    No The topic block does not retrieve user coordinates and displays a relevant error message for the topic author to resolve. The error is logged as an output parameter. For details, see Geolocation topic block parameters.

    Modify the Geolocation topic block

    If you are a topic author or an admin, you can modify the Geolocation topic block flow, as applicable. Simply duplicate the topic block and rename it. You can then use it as needed in the larger conversation flow you're designing.

    The Geolocation topic block properties sheet lets topic authors specify the input and output mappings. You can also customize the prompt using data pills or scripts. For example, you can include an explanation or reason for asking the question. For information about using data pills and scripts, see Virtual Agent Designer controls.
    Figure 1. Share location prompt in the Geolocation topic block properties
    The value of the permissionPrompt string is "Would you like to share your location?"

    Use the input mappings to customize how Virtual Agent asks users for permission to share their location. The response is passed to the topic block.

    Use the output mappings to specify the variables that are returned from the topic block in the conversation.
    Figure 2. Output mapping properties in the Geolocation topic block
    Geolocation output mapping parameters include latitude, longitude, errormessage, errortype, and status.

    All the variables are selected by default. Keep the default choices, or select the variables you want returned from the topic block. At a minimum, you should select the latitude and longitude coordinates. However, error messages, error type, and status details could be useful when resolving problems. The output mappings you select are stored as variables on the server.

    Figure 3. Geolocation topic block results
    Geolocation topic block results read, "This is what I got back," followed by the latitude and longitude, an OK status, and no error.

    For more information about the Geolocation topic block properties, see Geolocation topic block parameters.