Useful JavaScript functions in Mendix client API

JavaScript functions that are available in the Mendix client API. These can be used in the browser console or in JavaScript actions (nanoflows).

This list is not complete, and these functions are not documented by Mendix. Which means support is limited.

mx.session.getConfig()

Locale

Returns object with the user locale info (language code, first day of the week, date and number patterns etc.) of the current user.

mx.session.getConfig("locale");

Constants

Returns array with objects containing the constants exposed to client.

mx.session.getConfig("constants");
// or if you are on a newer Mx version (> 9.x )
mx.session.getConstants();

isDevModeEnabled

Returns boolean.

mx.session.getConfig("isDevModeEnabled");

Metadata

Returns array with objects containing all entities and attributes available to the current user1.

mx.session.getConfig("metadata");

Similar to the mx.meta.getMap();

Roles

Returns array of user roles of current user.

mx.session.getConfig("roles");

User

Returns object current user (system.user or it’s specialization administration.account, company.employee) with attributes and it’s values.

mx.session.getConfig("user");

sessionObjectId

Returns integer sessionObjectId

mx.session.getConfig("sessionObjectId");

Demo Users

Returns an array with objects containing the demo users; username, password and roles.

mx.session.getConfig("demoUsers");

mx.meta.getMap()

getMap

Returns array with objects containing all entities and attributes available to the user1.

mx.meta.getMap();

Similar to the mx.session.getConfig(“metadata”)


  1. This feature is often used to do a scripted security scan. Can also be abused to leak data and I hope Mendix removes these features from the client api to make it a bit harder to detect for bad actors which entities are unprotected. ↩︎ ↩︎