Global

Methods

# getCSRFToken() → {string}

Gets the CSRF token.

the CSRF token

string
Example
getCSRFToken();

# getUserId() → {GUID}

Gets the current user’s GUID.

GUID of the current user

GUID
Example
getUserId(); // "2533274790395905"

# getUserName() → {string}

Gets the Name attribute of the current user.

Name attribute of the current user

string
Example
getUserName(); // "MxAdmin"

# getUserRoleNames() → {Array.<string>}

Gets names of the current user’s roles.

names of the current user's roles.

Array.<string>

# isGuest() → {boolean}

Determines if this is an anonymous session.

true if the current user is anonymous, false otherwise

boolean
Example
isGuest();

Type Definitions

"AutoNumber" | "Binary" | "Boolean" | "DateTime" | "Decimal" | "Enum" | "EnumSet" | "HashString" | "Integer" | "Long" | "ObjectReference" | "ObjectReferenceSet" | "String"

# AttributeType

Represents the type of attribute.

undefined | string | boolean | Date | BigJS | GUID | Array

# AttributeValue

Represents the value of an attribute.

string

# DateFormattingPattern

Type for describing a date format. The following tokens can be used:

Letter Date or Time Component Examples
M Month in year, digit 1
MM Month in year, digit with leading zero 01
MMM Month in year, abbreviated (context sensitive) Nov
MMMM Month in year (context sensitive) November
L Month in year, digit (standalone), digit 1
LL Month in year, digit with leading zero 01
LLL Month in year, abbreviated (standalone) Nov
LLLL Month in year (standalone) November
yy Year, two digits 01
yyyy Year, four digits 2001
G Era designator AD
E Day name in week, abbreviated Tue
EEEE Day name in week Tuesday
u Day of week (1 = Monday, ..., 7 = Sunday) 5
w Week in year 11
W Week in month 2
D Day in year 133
d Day in month 7
F Day of week in month 1
a Am/pm marker PM
H Hour in day (0-23) 0
k Hour in day (1-24) 24
K Hour in am/pm (0-11) 0
h Hour in am/pm (1-12) 12
m Minute in hour 24
s Second in minute 50
S Millisecond 201
string

# Entity

Name of the Entity

Example
MyFirstModule.Entity
string

# GUID

Represents a GUID of a MxObject

Example
"12345678"
FunctionQueryFilter | ValueQueryFilter | AttributeQueryFilter | AssociationQueryFilter | RelatedEntityQueryFilter

# QueryFilter

A query to filter returned records in the local database. Only supported in offline apps.

Example
const complexFilter = {
  type: "function",
  name: "and",
  parameters: [
    {
      type: "function",
      name: "=",
      parameters: [
        { type: "attribute", attribute: "Name", attributeType: "String" },
        { type: "value", value: "John" }
      ]
    },
    {
      type: "function",
      name: "or",
      parameters: [
        {
          type: "function",
          name: "contains",
          parameters: [
            { type: "attribute", attribute: "Employer", attributeType: "String" },
            { type: "value", value: "Mendix" }
          ]
        },
        {
          type: "function",
          name: "not",
          parameters: [
            {
              type: "function",
              name: "=",
              parameters: [
                { type: "attribute", attribute: "Age", attributeType: "Integer" },
                { type: "value", value: 30 }
              ]
            },
            {
              type: "function",
              name: "and",
              parameters: [
                {
                  type: "function",
                  name: "starts-with",
                  parameters: [
                    { type: "attribute", attribute: "FirstName", attributeType: "String" },
                    { type: "value", value: "A" }
                  ]
                },
                {
                  type: "function",
                  name: "ends-with",
                  parameters: [
                    { type: "attribute", attribute: "LastName", attributeType: "String" },
                    { type: "value", value: "son" }
                  ]
                }
              ]
            }
          ]
        }
      ]
    }
  ]
};