Navigate between FileMaker and an app

Screen navigation within a Web Viewer app uses client-side JavaScript routing. When a user clicks an in-app button or link, the client-side router updates the view immediately without a network round trip to FileMaker.

This topic covers in-app routing and the methods used when FileMaker scripts trigger navigation. For startup route configuration, see Initial props. For hosting multiple entry points in a bundle, see Multiple apps.

Within the Web Viewer app, navigation operates through standard router links or programmatic navigate() calls. Hash-based routing stores the active route in window.location.hash, which preserves navigation state across page reloads without requiring server-side routing support.

A FileMaker script can also navigate the user to another view. Depending on the target destination, use one of the following approaches:

If the destination is a native FileMaker layout outside the Web Viewer, trigger a FileMaker script from JavaScript using callFMScript:

Copy
callFMScript(
  "Navigate Away From Web Viewer",
  { layout: "Contacts" },
  FMScriptOption.RESUME,
);

See Call FileMaker scripts from an app for details on asynchronous script execution.

If the destination is an internal screen within the Web Viewer app, the FileMaker script must communicate into the running web client using a registered command:

Copy
export function CommandNavigation() {
  const navigate = useNavigate();

  useWebViewerCommand("openCustomer", (recordId) => {
    navigate({ to: "/customers/$id", params: { id: recordId } });
  });

  return null;
}

To invoke the command from FileMaker, use the Perform JavaScript in Web Viewer script step:

Copy
Perform JavaScript in Web Viewer [ Object Name: "web" ; Function Name: "adk.openCustomer" ; Parameters: Customers::id ]

See Commands for complete command registration options, including the useWebViewerCommand hook and the static registerWebViewerCommand method.