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.
confetti
Display a confetti animation.
utils.confetti()
copyToClipboard
Copy the specified data to the clipboard.
downloadFile
Export and download Base64-encoded data.
downloadPage
Export and download a PDF of the current view for the app in the browser.
utils.downloadPage(fileName, downloadPageOptions)
Parameters
downloadPageOptions
fileName
The file name.
exportData
Exports table data as a file in a CSV, TSV, JSON, or Excel format.
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.
openApp
Navigates to another Retool app within the organization.
utils.openApp(uuid, options)
Parameters
uuid, options
openUrl
Navigates to the specified URL.
utils.openUrl(url, openUrlOptions)
playSound
Plays an audio file at a specified URL. Supports all browser-compatible audio formats.
utils.playSound(url)
Parameters
url
The URL.
serializePage
Serializes the current Retool page as a Base64-encoded PDF string. Returns the Base64-encoded string.
utils.serializePage(serializePageOptions)
Parameters
serializePageOptions
Properties
showNotification
Display an in-app notification.
utils.showNotification(showNotificationOptions)
Parameters
showNotificationOptions
Additional options to use.
Properties
description
The notification body text.
duration
The duration that the notification should remain visible, in seconds.
notificationType
The notification type to display. notificationType
also determines the notification color scheme. Defaults to info
.
Values
info | Info notification. |
success | Success notification. |
warning | Warning notification. |
error | Error notification. |
title
The notification title.