Skip to main content

refresh()

Last updated 21/01/2026

Definition

The

is a function on the

FormPage
object that reloads or updates the form page with the latest data. Optionally, you can refresh form pages in the form hierarchy using the
includeParents
parameter.

Examples

The following functions demonstrate how you can use the

refresh()
function on the
FormPage
object.

Refresh a field due to status

This code checks the value of the Status field on the current page. If the status is Pending, it logs a message to the Five Inspector, refreshes the page to get the latest data, and then logs another message indicating that the refresh is complete.

JavaScript
Auto-refresh page when status is Pending
const page = five.sender();

const statusField = page.getField("Status");
if (statusField.getValue() === "Pending") {
five.log("Status is pending, refreshing page...");
page.refresh();
five.log("Page refreshed with latest data");
}

Refresh before reading fields

This code gets the current form page, refreshes it to make sure the data is up-to-date, then reads the values of the ApprovalStatus and Comments fields, and logs them to the Five Inspector.

JavaScript
Log latest approval status and comments values after refreshing the page
const page = five.sender();

page.refresh();

const approval = page.getField("ApprovalStatus").getValue();
const comments = page.getField("Comments").getValue();

five.log("Approval:", approval);
five.log("Comments:", comments);

Conditional refresh based on tab type

This code checks which type of tab the current form page is on, either a Form or a List page. If it's a Form tab, it displays a message in the UI and refreshes the page to ensure the data is up-to-date. If it's a List page type, it displays a message and does nothing.

JavaScript
Conditional page refresh based on the tab type
const page = five.sender();

if (page.getTabType() === "F") {
five.showMessage("Form page detected, refreshing page for the latest data...");
page.refresh();
} else {
five.showMessage("List page detected, no refresh needed");
}

Refresh only if a checkbox is checked

This code checks a Boolean (checkbox) field on the current form page to decide whether the page needs to be refreshed. If the checkbox is checked, it refreshes the page to reload the latest data.

JavaScript
Refresh page when refresh flag is set to true
const page = five.sender();

const checkField = page.getField("NeedsRefresh");
if (checkField.getValue() === true) {
five.log("Checkbox checked, refreshing page...");
page.refresh();
}

Using the optional includeParents parameter

This code retrieves the current form page and performs a full refresh that includes both the current page and its related parents. After completing the refresh, it logs a confirmation message to the Five Inspector.

JavaScript
Refresh current page and any parents
const form = five.sender();

// Refresh this page and any parents
page.refresh(true);

five.log("Current page and parents have been refreshed");