The Utils JavaScript Library
JavaScript methods for interacting with apps.
Use the utils
JavaScript API methods to perform actions and control behavior.
These methods are not available within transformers or workflows.
JavaScript API methods for this object. You can write JavaScript almost anywhere in Retool and use methods to manipulate data and property values.
utils.copyToClipboard
Copy the specified data to the clipboard.
utils.copyToClipboard(data)
Parameters
Examples
utils.downloadFile
Download the specified data as a file. data
can be a string for plain text data or an object containing base64-encoded binary data.
utils.downloadFile(data, fileName, fileType)
Parameters
Examples
utils.downloadPage
Export and download a PDF of the current view for the app in the browser.
utils.downloadPage(options)
Parameters
utils.exportData
Exports data as a file in a CSV, TSV, JSON, or Excel format.
utils.exportData(options)
Parameters
utils.getCurrentPosition
Retrieves the user's current geographical location, if allowed by the user.
await utils.getCurrentPosition()
Returns
Examples
utils.getDataByObjectURL
Converts the contents of a blob:
or file://
URL to a Base64-encoded string. Returns a Base64-encoded string.
utils.getDataByObjectURL(data)
Parameters
utils.openApp
Navigates to another Retool app within the organization.
utils.openApp(uuid, options)
Parameters
utils.openPage
Navigates to another page within the app.
utils.openPage(pageName)
Parameters
utils.playSound
Plays an audio file at a specified URL. Supports all browser-compatible audio formats.
utils.playSound(url)
Parameters
utils.serializePage
Serializes the current Retool page as a Base64-encoded PDF string. Returns the Base64-encoded string.
utils.serializePage()
utils.showNotification
Display an in-app notification.
utils.showNotification(options)