Global Object
The Global
object is available when building backend API steps or writing frontend JavaScript within Applications. It holds metadata such as the current URL, the end-user accessing the application, or the browser's local storage. This metadata can be used to reference a user's groups in code or access the query parameters to dynamically pass data between applications. Use CMD
/CTRL
+ k
to pull up the Global
object as well as other available variables in backend API steps or when writing JavaScript inside frontend components.
Application created and deployed times are presented in ISO 8601 string format. These can be modified into other formats such as with JavaScript's moment library:
{{moment(Global.deployedAt).format("MM/DD/YYYY HH:mm:ss")}}
Available metadata
Metadata type | Property | Description | Full Path |
---|---|---|---|
Application | createdAt | The application creation time in ISO 8601 string (UTC) | Global.createdAt |
Application | deployedAt | The application deployment time in ISO 8601 string (UTC) | Global.deployedAt |
Application | mode | The mode the application is in when the user views it EDIT , PREVIEW , or PUBLISHED | Global.mode |
Groups | groups | An array of all the groups in your Superblocks organization | Global.groups |
Profiles | available | Returns the full list of profiles defined in Profile Settings for the current mode of your App, Workflow, or Scheduled Job. Ex: When viewing your deployed Application, this will only list the profiles set up for the Deployed mode | {{Global.profiles.available}} |
Profiles | default | Returns the default profile for the current mode of your App, Workflow, or Scheduled Job | {{Global.profiles.default}} |
Profiles | selected | Gives you the currently selected profile that will be used when executing APIs. This value will change when calling the Set Profile action | {{Global.profiles.selected}} |
URL | fullpath | A string representation of the full URL of the application | Global.URL.fullpath |
URL | host | The host component of the URL (e.g. app.superblocks.com ) | Global.URL.host |
URL | pathname | The path component of the URL (e.g. /applications/123/pages/456 ) | Global.URL.pathname |
URL | queryParams | An object containing key-value pairs representing the query parameters present in the URL. | Global.URL.queryParams |
URL | store | DEPRECATED: Use Frontend Variables instead. An object containing key-value pairs representing the contents of the browser's local storage | Global.URL.store |
User | email | The email associated with the end-user viewing and using the application | Global.user.email |
User | groups | An array of groups the user viewing the application is a member of | Global.user.groups |
User | id | The id associated with the end-user viewing and using the application | Global.user.id |
User | name | The name associated with the end-user viewing and using the application (see warning below) | Global.user.name |
User | username | The username associated with the end-user viewing and using the application | Global.user.username |
Versions | current.deployedAt | The application deployment time in ISO 8601 string (UTC) | Global.versions.current.deployedAt |
Versions | current.deployedBy.email | The email of the user who deployed the current version of the application | Global.versions.current.deployedBy.email |
Versions | current.description | The description of the currently deployed version of the application | Global.versions.current.description |
Versions | current.tag | The version tag of the currently deployed version of the application | Global.versions.current.tag |
When using {{Global.versions}}
, you will not see any information populated until the Application has been deployed. That is, it is expected that the object appears empty when viewing the application in Edit and in Preview mode.
Display names, which are viewed via {{Global.user.name}}
, are only available for users who Login with Google or via SSO.