Built-in Variables

There are several built-in variables available.

currentPage

To access some of the current page's metadata, such as ID and title, there is a built-in variable named currentPage on the application object. The currentPage variable automatically updates as the current page changes during navigation. This can be used to update a navigation component with the currently selected page.

Name Description
$application.currentPage.id The path of the current page. The path describes the location of the page in the flow hierarchy.
$application.currentPage.path The path of the current page for the application. The path describes the location of the page in the flow hierarchy.
$application.currentPage.title The title of the current page. The title is formed by prepending all the titles of the shells in the flow hierarchy to the current page.
$flow.currentPage The id of the current page for this flow.

currentFlow

If there is a routerFlow in the page, the $page.currentFlow variable can be used to retrieve the id of this flow.

Name Description
$page.currentFlow The id of the current flow.

current App UI

The current following App UI variables are available on the global object when using App UIs.

Name Description
$global.currentAppUi.id The id of the App UI
$global.currentAppUi.urlId The id of the App UI as shown in the URL
$global.currentAppUi.displayName The display name for the App UI
$global.currentAppUi.description The description of the App UI
$global.currentAppUi.defaultPage The default page of the App UI (if there is one)
$global.currentAppUi.defaultFlow The default flow of the App UI (if there is one)
$global.currentAppUi.applicationStripe The stripe of the custom App UI
$global.currentAppUi.pillarTheme The pillar theme to use for the App UI
$global.currentAppUi.pillarThemeMode The pillar theme mode to use for the App UI
$global.currentAppUi.icon The icon of the custom App UI
$global.currentAppUi.usage (This variable is reserved for Oracle Cloud Applications)
$global.currentAppUi.menuDisplayName The name of the custom App UI
$global.currentAppUi.extensible (Boolean) If this App UI can be extended

deployment

Use the deployment variable to distinguish between web, mobile, and progressive web applications that have been deployed from VB Studio.

Name Description
$application.deployment.appType Deprecated. The variable is always set to web.
$application.deployment.pwa = 'enabled' || 'disabled'

Used to indicate if application is configured as a progressive web applications (PWA).

For a web application, $application.deployment.pwa is always 'disabled', regardless of whether the web application is running in the Designer or deployed.

For a PWA, the value of $application.deployment.pwa is set to 'disabled' when the application is in the VB Studio Designer and $application.deployment.pwa is set to 'enabled' when the application is deployed.

path

The path variable is used to build the path to a resource, such as an image located in a folder in the application or in a flow. 

Name Description
$application.path The path needed to retrieve a resource located in the application folder.
$flow.path The path needed to retrieve a resource in the flow folder.
$extension.path The path needed to retrieve a resource in the current extension.

user

The user variable is used to access information about the current user. It is based on the User Info returned by the Security Provider. It is possible to modify the set of user information by changing the implementation of the Security Provider. See Security.

Name Description
$application.user.userId The user id <string>.
$application.user.fullName The user full name <string>.
$application.user.email The user email <string>.
$application.user.username The user name <string>.
$application.user.roles The user roles (array of strings).
$application.user.roles.roleName Returns true if roleName is a role of this user.
$application.user.permissions User permissions (array of strings).
$application.user.permissions.permName Returns true if permName is a permission of this user.
$application.user.isAuthenticated Returns true if this user is authenticated.

translations

This is not a variable, but an API available for getting localized strings using $<container>.translations.<bundlename>.key, or $container.<translations>.format(<bundlename>,<key>,args...).

This API exists for $application, $flow, and $page, but is only useful if you have defined translation bundles. If translation values are needed in JavaScript function modules, they must be passed as arguments to the function.

responsive

This is not directly a variable, but contains several Knockout Observables that represent JET Media Queries. The following are available, and are accessible via $application.responsive.XXX (for example, $application.responsive.smUp): smUp, mdUp, lgUp, xlUp, smOnly, mdOnly, lgOnly.

info

Some information from the application and page descriptor can be retrieved using the info keyword.

Name Description
$application.info.id The application id defined in app-flow.json
$application.info.description The application description defined in app-flow.json
$flow.info.id The flow id defined in flow-id-flow.json
$flow.info.description The flow description defined in flow-id-flow.json
$page.info.title The page title defined in page-id-page.json
$page.info.description The page description defined in page-id-page.json
$fragment.info.id

This is the id set on the oj-vb-fragment component or the system generated stable id (if an id is not set on the component).

The fragment id defined in fragment-id-fragment.json
$fragment.info.title The fragment title defined in fragment-id-fragment.json.
$fragment.info.description The fragment description defined in fragment-id-fragment.json.
$layout.info.id The layout id.

components

This is not a variable, but contains utility methods for finding JET components on a page. These methods return an element that is a JET component. If no element is found, or if the element is not part of a JET component, these methods will return null.

Note:

These methods are not for finding general elements To find elements on the page, use methods such as document.getElementById and document.querySelector.
Name Description
$page.components.byId('myCard') (deprecated) Use document.getElementById, which returns a JET Component or null.
$page.components.bySelector('#myCompId') (deprecated) Use document.querySelector, which returns a JET Component or null.