The Utils JavaScript Library
JavaScript methods for interacting with apps.
Use the utils
JavaScript API methods to perform actions and control behavior.
utils
methods are not available within transformers or within workflows.
Methods
JavaScript API methods for interacting with utils
. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
changeLocale
Change the user's locale.
utils.changeLocale(value)
Parameters
confetti
Display a confetti animation.
utils.confetti()
copyToClipboard
Copy the specified data to the clipboard.
utils.copyToClipboard(value)
Parameters
downloadFile
Export and download Base64-encoded data.
utils.downloadFile(downloadFileOptions)
Parameters
downloadPage
Export and download a PDF of the current view for the app in the browser.
utils.downloadPage(fileName, downloadPageOptions)
Parameters
exportData
Exports table data as a file in a CSV, TSV, JSON, or Excel format.
utils.exportData(exportDataOptions)
Parameters
getCurrentPosition
Retrieves the user's current geographical location, if allowed by the user.
utils.getCurrentPosition()
getDataByObjectURL
Converts the contents of a blob:
or file://
URL to a Base64-encoded string. Returns a Base64-encoded string.
utils.getDataByObjectURL(value)
Parameters
openApp
Navigates to another Retool app within the organization.
utils.openApp(uuid, options)
Parameters
openUrl
Navigates to the specified URL.
utils.openUrl(url, openUrlOptions)
Parameters
playSound
Plays an audio file at a specified URL. Supports all browser-compatible audio formats.
utils.playSound(url)
Parameters
serializePage
Serializes the current Retool page as a Base64-encoded PDF string. Returns the Base64-encoded string.
utils.serializePage(serializePageOptions)
Parameters
showNotification
Display an in-app notification.
utils.showNotification(showNotificationOptions)