Geolocation field

Capture a GPS location, current position or pick on a map. Binds to SharePoint's Geolocation column.

The Geolocation field captures a latitude/longitude pair. Three modes: use the device's current GPS position (with permission prompt), pick a point on an embedded map, or enter coordinates manually. Binds to SharePoint's Geolocation column.

Common properties

PropertyDescription
label
string
Visible label.
description
string
Helper text.
required
boolean
default: false
Marks the field required, both latitude and longitude must be set.
readOnly
boolean
default: false
Disables the coordinate inputs and hides the "Use my location" button.

Type-specific properties

PropertyDescription
showMapPreview
boolean
default: true
Show an inline map preview alongside the coordinate inputs.

The stored value is a JSON string of the SharePoint Geolocation shape, { Latitude: number, Longitude: number }, or an empty string when unset.

JavaScript recipes

Read the coordinates

const raw = f365.field('Site').value as string;
const coords = raw ? (JSON.parse(raw) as { Latitude: number; Longitude: number }) : null;
if (coords) {
  f365.ui.showToast(
    `${f365.format.number(coords.Latitude)}, ${f365.format.number(coords.Longitude)}`
  );
}

Set coordinates programmatically

f365.field('Site').value = JSON.stringify({ Latitude: -33.8688, Longitude: 151.2093 });

Validate the point falls inside a bounding box

f365.events.onBeforeSave(async () => {
  const raw = f365.field('Site').value as string;
  if (!raw) return true;
  const { Latitude, Longitude } = JSON.parse(raw) as { Latitude: number; Longitude: number };
  // Rough Australia bounding box.
  const inside = Latitude <= -10 && Latitude >= -44 && Longitude >= 112 && Longitude <= 154;
  if (!inside) {
    await f365.ui.showAlert('Pick a location within Australia.');
    return false;
  }
  return true;
});

React when the location changes

f365.events.onLoad(() => {
  f365.field('Site').on('change', (raw) => {
    if (raw) f365.ui.showToast('Location updated', 'success');
  });
});

Related articles

  • Text field

    Single-line text input, the foundation field for names, codes, and short free-text.