Skip to content

elements.LabelText

Overview

Change the name displayed of buttons and menus using "Server Script".

Limitations

  1. You can change the name displayed of the buttons added in the "Navigation Menu" at the top of the screen, the "Command Buttons" at the bottom of the screen, and the "Process".
  2. This cannot be applied to the back button.

Syntax

elements.LabelText(key, labelText)

Parameters

Parameter Type Required Overview
key string Yes HTML ID attribute
labelText string Yes Character string

Return Value

There is no return value.

Usage Examples

In the example below, we will change the name displayed of the update button to "Update".

JavaScript
elements.LabelText('UpdateCommand','Update');

Code Samples

1. Set the label of a process button to today's date

Set the label of the button configured in a process to "Get data for {today's date}".

JavaScript
const dateFormat = (input) => {
    if (!input) return '';
    // The return value is a string, so convert it with new Date()
    const date = new Date(input);
    const y = date.getFullYear();
    const m = String(date.getMonth() + 1).padStart(1, '0');
    const d = String(date.getDate()).padStart(1, '0');
    const dateTime = `${y}/${m}/${d}`;
    return dateTime;
};
elements.LabelText('Process_1', `Get data for ${dateFormat(utilities.Today())}`);