actionID()
Last updated 14/01/2026
Definition
The actionID() is a function on the
Form
object that returns a string identifier for the action associated with that form. It is used to differentiate forms in your code based on the action they represent.
Examples
The following functions demonstrate how you can use the
actionID()
function on the Form
object.
Log the Action ID to the Five Inspector
This code logs the form's action ID to the Five Inspector.
Logs the form's action ID to the Five Inspector
// Get the current form object
const form = getCurrentForm();
// Log the action ID of this form
five.log("This form's action ID is:", form.actionID())
Initialize form for specific action
This code initializes a form with the specific action ID.
Ensures your code only reponds to the form that equals the action ID
const form = getCurrentForm();
// Only run this code if the form is tied to a specific action
if (form.actionID() === "Buys") {
// Code here runs only when the form's action ID is Buys
}
Conditional behavior
This code returns the action ID for the form and the
if
and else
conditions allow you to run different code depending on the
action and logs the result to the Five Inspector.
Conditional behaviour depending on the action ID associated to the form
// Get the current form object
const form = getCurrentForm();
// Check the action ID and perform behavior accordingly
if (form.actionID() === "Buys") {
five.log("A purchase is being created");
} else if (form.actionID() === "Sells") {
five.log("A sale is being created");
}
Using with the getParent() function
This code demonstrates how you can use
actionID()
together with getParent()
on a Form
object to check both the current form's action and its parent form's action.
Get action ID of form with optional parent check
// Get the current form
const form = getCurrentForm();
// Get the parent form (if it exists)
const parentForm = form.getParent();
// Log the action ID of the parent form, if there is one
if (parentForm) {
five.log("Parent form action ID:" parentForm.actionID());
} else {
five.log("This form has no parent");
}
// Example conditional behaviour using both
if (form.actionID() === "EditMeasurement" && parentForm && parentForm.actionID() === "OpenProject") {
five.log("Editing a measurement within an open project");
} else {
five.log("Other form workflow");
}