Skip to main content

Built-in JavaScript utilities

note

* indicates different implementations between designer mode and runtime mode.

Data storage utilities

this.utils.dataStore

  • Stores and retrieves data for page references
  • Methods include:
async getData(key: string)
async setData(key: string, value: any)
async clearData()
VariableMandatoryInput FormatValue Options
keyYesStringAny string
valueYesAnyAny

this.utils.context

  • Passes data between pages
  • Methods include:
static getDataMap(object: any)
static setData(object: any, key: string, data: any)
static getData(object: any, key: string)
static clearData(object: any) //Added in version 5.0.0
VariableMandatoryInput FormatValue Options
objectYesAnyAny
keyYesStringAny string
dataYesAnyAny

this.props.context

  • Shares data across pages

Third-party libraries

this.utils.FileSaver

  • Uses the file-saver library for file operations

this.utils.dateFormat

  • Uses the dateformat library for formatting dates

*this.utils.navigateTo(appId: string, pageId: string, data: any, object: this)

  • Navigates to a specific page within an app
VariableMandatoryInput FormatValue Options
appIdYesStringAny string
pageIdYesStringAny string
dataYesAnyAny
objectYesthisthis

*this.utils.navigateToCurrAppPages(pageId: string, data: any, object: this)

  • Navigates within the current app pages
VariableMandatoryInput FormatValue Options
pageIdYesStringAny string
dataYesAnyAny
objectYesthisthis

*this.utils.getNavigatedData(key: string, object: any)

  • Retrieves data passed between pages
VariableMandatoryInput FormatValue Options
keyYesStringAny string
objectYesAnyAny

Security and role management

this.utils.RSAUtil

  • Encrypts passwords
  • Methods include:
static convertJwkToPem(jwk: string)
static encrypt(text: string, pucKey: any, keyFormat = 'jwk')
VariableMandatoryInput FormatValue Options
jwkYesStringAny string
textYesStringAny string
pucKeyYesAnyAny
keyFormatYesConstantjwk

this.utils.RolesUtils

  • Manages user roles for filtering navigators in preview mode
  • Methods include:
static delete(role: string, userDomain: string)
static set(role: string, userDomain: string)
static getRoles()
static clear()
static saveRoles(roles: string[], userDomain: string)
VariableMandatoryInput FormatValue Options
roleYesStringAny string
userDomainYesStringAny string

Utility functions

this.utils.getUrlParams()

  • Retrieves URL parameters

this.utils.hasSuperAdminPrivilege()

  • Checks if the current user is a super admin

*this.utils.getAssetsUrl(assetsName: string, fileName: string)

  • Retrieves asset file URLs. The URL is different between design and runtime
  • Added in version 4.0.4
VariableMandatoryInput FormatValue Options
assetsNameYesStringAny string
fileNameYesStringAny string

this.utils.handleProfile

  • Performs virtual login with a profile in preview mode. This only works in preview and will not generate in runtime
  • Methods include:
async handleProfile(data: {
userDomainCode: string;
userAccountId: string;
vault: string })
VariableMandatoryInput FormatValue Options
userDomainCodeYesStringAny string
userAccountIdYesStringAny string
vaultYesStringAny string

this.utils.getCSRF()

  • Retrieves CSRF token
  • Added in version 4.0.5

this.utils.formatDateWithOffset: (isoString: any)

  • Converts ISO string to the format with time zone offset
  • Added in version 5.0.0
VariableMandatoryInput FormatValue Options
isoStringYesStringAny string

this.utils.getMenuPassingData()

  • Retrieves the passing data
  • Add in version 5.0.0

this.utils.getConfig: async (key: string)

  • Retrieves all global setting of the current application by key
  • Added in version 5.0.0
VariableMandatoryInput FormatValue Options
keyYesStringAny string

this.utils.ApplicationProvider.getGlobalSettings()

  • Retrieves all global settings of the current application
  • Added in version 5.1.0

this.props.saveContext: (key: string, value: any)

  • Saves an object to be shared across pages
  • Added in version 5.1.0
VariableMandatoryInput FormatValue Options
keyYesStringAny string
valueYesAnyAny

this.context.<key>

  • Retrieves the object variable key name, which was saved into context
  • Added in version 5.1.0

*this.utils.showMessage: async (type: MessageType, title: any, closeable: boolean, content?: any)

  • Displays popup messages, configurable for manual closing or auto closing
  • When MESSAGE_DURATION is set to 0 or closeable is true, manual closing is enabled
  • Added in version 5.1.1
VariableMandatoryInput FormatValue Options
typeYesMessageTypehelp, warning, error, success, notice, or loading
titleYesAnyAny
closeableYesBooleantrue
content?NoAnyAny

Last updated on 20 May 2026