LogoLogo
  • Introduction
  • Features
  • Getting Started
    • Cortex User Guide
      • Organizations
      • Log in
      • Generate an API key
      • Make your first API request
      • Configure the org settings
      • Set up a data model
        • Create custom objects
        • Add custom properties
      • One-to-many relationships
      • Read and write data
      • Making a Request
      • Handling responses
      • Authentication
      • Two-factor authentication
      • Set third-party cookies
      • Connections
      • Upload files
      • Cortex iOS
      • Get started with Swift
      • Cortex service accounts
      • Cortex developer tools
      • Automated Account Notifications
  • Cortex API
    • Overview
    • Objects
      • Objects Overview
      • Organization
      • Account
      • Connections
      • Notifications
      • Stats
      • Logs
      • Export
      • Events
      • Room
    • Object Definition
      • Object Properties
        • Any
        • Binary
        • Boolean
        • Date
        • Document
        • File
        • Geometry
        • List
        • Number
        • ObjectId
        • Reference
        • String
    • Object Types
    • Access Control
    • Querying
      • Query Operators
      • Property Selection
      • Property Access
    • Aggregating
      • Aggregation Operators
    • Scripting
      • Script Types
      • Script Limits
      • ObjectId
      • CortexObject
        • Accounts
        • Views
      • Cursors
      • Operations
      • Script Modules
        • API Module
        • Base64 Module
        • Cache Module
        • Connections Module
        • Console Module
        • Consts Module
        • Counters Module
        • Crypto Module
        • HTTP Module
        • Logger Module
        • Notifications Module
        • Request Module
        • Response Module
        • SAML Module
        • Schemas Modules
        • Script Module
        • Session Module
        • Util.id Module
        • Util.ip Module
        • Util.paths Module
        • XML Module
        • Developer
        • Config
        • Renderer
        • SFTP
        • FTP
        • DB
          • Cursors
          • Driver
      • Static Methods
        • Accounts
        • Views
        • Cursors
      • Audit
      • Environments
      • HTTP Driver
      • Notifications
        • Firebase Cloud Messaging (FCM)
        • Tencent Push Notification Service Configuration
      • Televisit
      • Transforms
      • Localization
      • Available Javascript Libraries
    • Decorators
      • Runtime
        • Acl
        • As
        • Log
        • Profile
      • Static
        • Env
        • Job
        • Object
        • On
        • Policy
        • Route
        • Transform
        • Trigger
    • Expressions
      • Primer
      • Pipelines
      • Operators
      • Accumulators
      • Variables
      • Conditionals
      • Transforms
      • Triggers
      • On
      • Events
    • Faults
      • Fault Reference
  • Releases
    • Cortex Release Notes
      • Cortex API 2.28.3 (R3.4.6)
      • Cortex API 2.28.1 (R3.4.3)
      • Cortex API 2.27.2 (R3.4.1)
      • Cortex API 2.27.1 (R3.3.5)
      • SQL DB Connector 1.3.4 (R3.3.3)
      • Cortex API 2.26.2 (R3.3.1)
      • Cortex API 2.26.1 (R3.2.2)
      • Cortex API 2.26.0 (R3.2.1)
      • SQL DB Connector 1.3.3
      • Cortex API 2.25.0 (R3.1.1)
      • SQL DB Connector 1.3.2 (R3.1.0)
      • Cortex API 2.24.2 (R3.0.2)
      • SQL DB Connector 1.3.1 (R3.0.0)
      • Cortex API 2.24.1 (R2.3.3)
      • Cortex API 2.24.0 (R2.3.2)
      • SQL DB Connector 1.3.0 (R2.3.0)
      • Cortex API 2.23.0 (R2.2.4)
      • SQL DB Connector 1.2.0 (R2.2.0)
      • Cortex API 2.22.2 (R2.1.2)
      • Cortex API 2.22.1 and SQL DB Connector 1.1.1 (R2.0.1)
      • Cortex API 2.22.0
      • Cortex API 2.21.3
      • Cortex API 2.21.2
      • Cortex Web 4.16.0
      • Cortex Web 4.15.1
      • Cortex API 2.20.1
      • Cortex Web 4.14.0
      • Cortex Renderer 1.3.3
      • Cortex API 2.19.4
      • Cortex API 2.19.3 and Cortex Web 4.13.1
      • Cortex Renderer 1.3.2
      • Cortex API 2.19.1
      • Cortex API 2.18.0
      • Cortex API 2.17.6
      • Cortex API 2.17.5
      • Cortex API 2.17.4
      • Cortex API 2.17.3
      • Cortex API 2.17.2
      • Cortex API 2.17.1
      • Cortex API 2.16.0
      • Cortex API 2.15.9
      • Cortex API 2.15.8-1
      • Cortex 2.15.8
      • Cortex API 2.18.1
      • Cortex API 2.16.1
      • Cortex Renderer 1.3.1
      • Cortex Renderer 1.3.0
      • Cortex Renderer 1.2.2
      • Cortex Renderer 1.2.1
      • Cortex Renderer 1.2.0
    • Third-Party License Attribution

© 2025 Medable, Inc. All rights reserved.

On this page

Was this helpful?

  1. Cortex API
  2. Scripting
  3. Script Modules

Consts Module

import consts from 'consts';

A global variable containing various constants.

An org's object codes are incorporated in consts.objects so the id of custom objects is available in readable form (eg. consts.object.c_surveys == ObjectID("4b756e6746752050616e6461")). The same holds true for custom notification types and roles.JSON

{
        "accessLevels": {
            "connected": 2,
            "delete": 7,
            "public": 1,
            "read": 4,
            "script": 8,
            "share": 5,
            "update": 6
        },
        "accessPrincipals": {
            "creator": 3,
            "owner": 4,
            "self": 2
        },
        "accessTargets": {
            "account": 1,
            "role": 3
        },
        "accessTypes": {
            "access": 5,
            "account": 1,
            "owner": 4,
            "role": 3,
            "self": 2
        },
        "accountStates": {
            "unverified": "unverified",
            "verified": "verified"
        },
        "audits": {
            "actions": {
                "both": 3,
                "none": 0,
                "read": 2,
                "write": 1
            },
            "actionsLookup": {
                "0": "none",
                "1": "write",
                "2": "read",
                "3": "both"
            },
            "operations": {
                "access": 9,
                "auth": 6,
                "delete": 5,
                "device": 8,
                "pull": 4,
                "push": 3,
                "remove": 2,
                "set": 1,
                "transfer": 7
            },
            "sources": {
                "request": 1,
                "script": 2,
                "system": 3
            }
        },
        "connectionStates": {
            "active": 1,
            "pending": 0
        },
        "emptyId": "000000000000000000000000",
        "http": {
            "methods": {
                "DELETE": 3,
                "GET": 0,
                "HEAD": 4,
                "OPTIONS": 5,
                "PATCH": 6,
                "POST": 1,
                "PUT": 2
            },
            "methodsLookup": {
                "0": "GET",
                "1": "POST",
                "2": "PUT",
                "3": "DELETE",
                "4": "HEAD",
                "5": "OPTIONS",
                "6": "PATCH"
            }
        },
        "logs": {
            "levels": {
                "debug": 3,
                "error": 0,
                "info": 2,
                "trace": 4,
                "warn": 1
            },
            "sources": {
                "api": 1,
                "audit": 4,
                "deployment": 5,
                "export": 6,
                "logger": 0,
                "notification": 7,
                "policy": 8,
                "request": 3,
                "script": 2
            }
        },
        "media": {
            "states": {
                "dead": 4,
                "error": 3,
                "pending": 0,
                "processing": 1,
                "ready": 2
            }
        },
        "notifications": {
            "endpoints": {
                "email": "456e64706f696e7420456d6c",
                "push": "456e64706f696e7420507368",
                "sms": "456e64706f696e7420536d73"
            },
            "states": {
                "disabled": 1,
                "enabled": 0,
                "user": 2
            },
            "types": {
                "account-activation": "4e6620416363744163746976",
                "account-activation-provider": "4e662041637441637450726f",
                "account-auth-locked": "4e6620417574684c636b6564",
                "account-provider-verification-processing": "4e662050726f765063736e67",
                "account-provider-verification-verified": "4e662050726f76436d706c74",
                "account-provisioned": "4e6620416363745072767364",
                "account-welcome": "4e662041637457656c636f6d",
                "account-welcome-activation": "4e662057656c636d41637476",
                "account-welcome-activation-provider": "4e6620576d4163747650726f",
                "account-welcome-provider": "4e662057656c636d50726f76",
                "account-welcome-verification": "4e6620416363745665726966",
                "account-welcome-verification-provider": "4e662041637456726650726f",
                "admin-account-registration-notification": "4e662041646d696e52656764",
                "admin-provider-verification-required-notification": "4e662041646d696e50726f56",
                "connection-created": "4e6620436e6e637443727464",
                "feed-comment-update": "4e66204665656473436d6e74",
                "feed-post-update": "4e66204665656473506f7374",
                "gcm-regid-reassigned": "4e662047636d52654173676e",
                "invite-existing-user": "4e6620496e76457873746e67",
                "invite-new-user": "4e6620496e764e6577557372",
                "ios-token-reassigned": "4e6620496f7352654173676e",
                "location-verification": "4e66204c6f6361746e566572",
                "lost-password": "4e66204c6f73745073737764",
                "mobile-change-notification": "4e66204368616e67654d6f62",
                "org-invitation": "4e6620496e765072764f7267",
                "password-change-notification": "4e66204368616e6765507373"
            }
        },
        "objects": {
            "accounts": "436f6e746578742041636374",
            "comments": "4f626a65637420436f6d6e74",
            "connections": "4f626a65637420436f6e6e20",
            "exports": "436f6e746578742045787074",
            "objects": "436f6e746578742043747820",
            "orgs": "436f6e74657874204f726720",
            "posts": "4f626a65637420506f737420",
            "scripts": "436f6e746578742053637269",
            "views": "436f6e746578742056696577"
        },
        "principals": {
            "anonymous": "000000000000000000000001",
            "public": "000000000000000000000003"
        },
        "roles": {
            "Administrator": "000000000000000000000004",
            "Developer": "000000000000000000000007",
            "Provider": "000000000000000000000005",
            "Support": "000000000000000000000006",
            "admin": "000000000000000000000004",
            "developer": "000000000000000000000007",
            "provider": "000000000000000000000005",
            "support": "000000000000000000000006"
        },
        "stats": {
            "locations": {
                "medable": 1,
                "s3": 2
            },
            "sources": {
                "accounts": 4,
                "cacheStorage": 7,
                "docStorage": 2,
                "fileStorage": 1,
                "logins": 3,
                "notifications": 6,
                "request": 0,
                "scripts": 5
            }
        }
    }

Last updated 3 years ago

Was this helpful?