Dropping a pin at the search location

Hi all,

This is my first query. I am using a map view (google maps) to allow users to search for records (suppliers) in proximity of a specified search address.

The challenge I have is that I need to drop a pin for the search address as well as the results, as its important that the user is able to see the results in the context/proximity of the specified search address.

I’ve tried two things:

  1. Calling the google API with javascript as advised by the knack help chatbot. This wont work as I am unable to retrieve the map control from the container:
const mapContainer = document.querySelector('[role="region"][aria-roledescription="map"]');
const map = mapContainer?.__gm?.map || mapContainer?.__gm?.getMap?.();  // <-- this never returns anything
  1. I thought i could create a Search_History table and use the knack API to create a record when the user submits a search that would include the search address, and the User ID and then configure the map view to display this record also, however, I’ve not been able to find a way to call the API with javascript to create a new record and the map view only supports sourcing records from a single table.

I’ve spent longer on this that I had planned and I really need to get a solution ASAP.

Is anyone able to help/advise?