Utils provides small helper functions used by many components and services.
Unified WebSocket calls
These helpers use the built-in client instance (exported asMSM2App) to call the unified WebSocket JSON API:
callService(beanId, scope, functionName, args, eventType?, endpoint?)callRepository(repositoryId, query, eventType?, endpoint?)updateBean(beanId, scope, payload, eventType?, endpoint?)
Calling a backend service
callService returns a Promise containing the full client response. The backend value is in response.result:
JSON.stringify(request). scope is usually PROTOTYPE; eventType can be USER, SHARED, or GLOBAL.
Calling a repository
Updating a bean
updateBean updates values on a bean registered with @Component or @Service.
MSM2App instance, which must be available before they are called.
Context and settings helpers
getLangCode()getActiveLanguages()getLanguageDetection()getWebSiteSettings()getCdnFolder()getSecuredFolder()getSeoUrl(entityId, repositoryName)getSuperUserLogin()getAttributeTypes()getAttributeAreaTypes()getFormattedDate(date, pattern)isLogged()getLoggedProfile()isOpenAiActive()
Cookies and URL helpers
getCookie(name)setCookie(name, value, expires?, domain?, path?)deleteAllCookies(ignore)getDomainName()languageAwareUrl(url)setPlatformInfo()escapeRegExp(string)getPayloadOfForm(element)