Skip to content

Object

Actions are written in standard JavaScript, but development requires the use of an action-specific object. An object is structural data that holds data. Objects include $ui and $const, which have preregistered properties, and $param and $session, to which properties can be added arbitrarily. There is also $req and $res which can only be used in REST API actions.

ObjectPurposeDescription
$uiAccess to UI componentsCan set/get values for registered properties
$paramData transfer to the next uiCan set/get any property
$sessionData transfer during a sessionCan set/get any property
$constConstant ReferencePossible to retrieve registered constant values
$reqRequest dataObtain HTTP request object in REST API action
$resResponse dataSet HTTP response object in REST API action

Tips

$ui

$ui is an object that represents the UI that defines the action. components placed in the UI can be retrieved as property values. It also indicates the state of the component as it appears in the UI after the action is executed.

Obtaining component values during action executionExample: const val = $ui.text_field_1.value;
Set component values after action executionExample: $ui.text_field_1.value = val;

The above shows an example of getting the value of a text field when an action is executed and an example of setting the value of a text field after the action is executed.

A component has not only a value, but also various other properties such as color, variants, etc. that decorate the component. They can be acquired/configured in the same way in the action.

Tips

$this

$this is an object that indicates the component that is executing the action. It can be used to obtain the property value of the component itself that is placed in the UI.

The available properties vary depending on the part, so they may not exist depending on the component that performed the action.

It is also possible to use functions that can be used commonly within an application, such as global functions. In the action of the component with ID "text_field_1", you can replace it with $this without entering the component ID, such as $ui.text_field_1.value.

Tips

$param

$param is a parameter object that sends arbitrary data to the next UI screen. Scope is up to the next UI screen. You can add any property in $param as follows

$param.name = “Adam”;
$param.age = 26;

You can receive $param in the onload action of the target UI.

const name = $param.name;
const age = $param.age;

Tips

$session

$session is a session object that manages arbitrary data during a session. The scope is the duration of the session. Arbitrary properties can be added and retrieved as well as parameters.

Tips

Session Duration

For authentication applications
Session duration is during the sign-in period.

Tips

For unauthenticated applications
The duration of a session can be up to 24 hours from the time the application is displayed. However, even within the duration of the session, it becomes invalid when the browser is closed.

$global

$global is an object for referencing the global functions you created. You can use global functions that are managed within your application. Example) const result = await $global.myFunction()

$const

$const is an object for referencing registered constants. You can retrieve the constant value using the name of the constant managed in the application. Example)$ui.nameField.label = $const.nameLabel;

Tips

$req

$req is an HTTP request object that can be used within a REST API action. Use the $req object to retrieve request data.
Refer to the Amazon Gateway API page for more information on the properties of the $req object.

PropertyType
bodystring
headersObject
httpMethodstring
isBase64Encodedboolean
multiValueHeadersObject
multiValueQueryStringParametersObject
Pathstring
pathParametersObject
queryStringParametersObject
requestContextObject
resourcestring
stageVariablesObject

$res

$res is an HTTP response object that can be used within a REST API action. Use the $res object to set the response data to be returned.
Refer to the Amazon Gateway API page for more information on the properties of the $res object.

PropertyType
bodystring
headersObject
isBase64Encodedboolean
multiValueHeadersObject
statusCodenumber