Ajax

Simplicite. Ajax

Simplicité® application.

Constructor

new Ajax(approot, gateway, login, password, async)

Example
// Using within the generic UI
const app = $ui.getAjax();
// Using user thru the UI gateway (e.g. within a custom disposition)
const app = new Simplicite.Ajax("" or "/myapp" if deployed non root or an absolute base URL);
// Using public user thru the public UI gateway (e.g. from a public web site)
const app = new Simplicite.Ajax("" or "/myapp" if deployed non root or an absolute base URL, "uipublic");
// Using website user thru the API gateway (e.g. form a custom frontend)
const app = new Simplicite.Ajax("" or "/myapp" if deployed non root or an absolute base URL, "api", "myuser", "mypassword");
Parameters:
Name Type Description
approot

Application root (either "/<context root>" or an absolute base URL)

gateway

Gateway type to use :

  • 1 or "ui": Authenticated UI gateway (default)
  • 2 or "uipublic" : Public UI gateway
  • 4 or "api" : API gateway
login

User's login (not required for UI gateways)

password

User's password (not required for UI gateways)

async

Asynchronous calls by default (true if absent) ?

Classes

BusinessObject
BusinessProcess
Grant
ObjectField
TreeView

Members

(constant) CONTEXT_ACTION :number

Description:
  • Action context.

Action context.

Type:
  • number

(constant) CONTEXT_AGENDA :number

Description:
  • Agenda context.

Agenda context.

Type:
  • number

(constant) CONTEXT_ASSOCIATE :number

Description:
  • Association context.

Association context.

Type:
  • number

(constant) CONTEXT_COPY :number

Description:
  • Copy context.

Copy context.

Type:
  • number

(constant) CONTEXT_CREATE :number

Description:
  • Creation context.

Creation context.

Type:
  • number

(constant) CONTEXT_CROSSTAB :number

Description:
  • Cross table context.

Cross table context.

Type:
  • number

(constant) CONTEXT_DATAMAPSELECT :number

Description:
  • Data mapping selection context.

Data mapping selection context.

Type:
  • number

(constant) CONTEXT_DELETE :number

Description:
  • Delete context.

Delete context.

Type:
  • number

(constant) CONTEXT_EXPORT :number

Description:
  • Export context.

Export context.

Type:
  • number

(constant) CONTEXT_IMPORT :number

Description:
  • Import context.

Import context.

Type:
  • number

(constant) CONTEXT_LIST :number

Description:
  • List context.

List context.

Type:
  • number

(constant) CONTEXT_NONE :number

Description:
  • No context.

No context.

Type:
  • number

(constant) CONTEXT_PANELLIST :number

Description:
  • Panel list context.

Panel list context.

Type:
  • number

(constant) CONTEXT_PLACEMAP :number

Description:
  • Place map context.

Place map context.

Type:
  • number

(constant) CONTEXT_POSTVALIDATE :number

Description:
  • Post validate context.

Post validate context.

Type:
  • number

(constant) CONTEXT_PREVALIDATE :number

Description:
  • Pre-validate context.

Pre-validate context.

Type:
  • number

(constant) CONTEXT_PRINTTMPL :number

Description:
  • Publication template context.

Publication template context.

Type:
  • number

(constant) CONTEXT_REFSELECT :number

Description:
  • Reference selection context.

Reference selection context.

Type:
  • number
Description:
  • Search context.

Search context.

Type:
  • number

(constant) CONTEXT_STATETRANSITION :number

Description:
  • State transition context.

State transition context.

Type:
  • number

(constant) CONTEXT_UPDATE :number

Description:
  • Update context.

Update context.

Type:
  • number

(constant) CONTEXT_UPDATEALL :number

Description:
  • Bulk update context.

Bulk update context.

Type:
  • number

(constant) DEFAULT_ROW_ID :string

Description:
  • Default row ID value (for creation).

Default row ID value (for creation).

Type:
  • string

(constant) ERRLEVEL_ERROR :number

Description:
  • Error error value

Error error value

Type:
  • number

(constant) ERRLEVEL_FATAL :number

Description:
  • Fatal error value

Fatal error value

Type:
  • number

(constant) ERRLEVEL_WARNING :number

Description:
  • Minor error value

Minor error value

Type:
  • number

(constant) FALSE :string

Description:
  • False value

False value

Type:
  • string

(constant) GATEWAY_API :string

Description:
  • API gateway

API gateway

Type:
  • string

(constant) GATEWAY_UI :string

Description:
  • UI gateway

UI gateway

Type:
  • string

(constant) GATEWAY_UI_PUBLIC :string

Description:
  • Public UI gateway

Public UI gateway

Type:
  • string

(constant) RENDERING_DEFAULT :string

Description:
  • Default rendering.

Default rendering.

Type:
  • string

(constant) RENDERING_HORIZCHECKBOX :string

Description:
  • Rendering horizontal checkbox(es).

Rendering horizontal checkbox(es).

Type:
  • string

(constant) RENDERING_HORIZRADIOBUTTON :string

Description:
  • Rendering horizontal radio button(s).

Rendering horizontal radio button(s).

Type:
  • string

(constant) RENDERING_SELECTBOX :string

Description:
  • Select box rendering (single or multiple select).

Select box rendering (single or multiple select).

Type:
  • string

(constant) RENDERING_VERTCHECKBOX :string

Description:
  • Rendering vertical checkbox(es).

Rendering vertical checkbox(es).

Type:
  • string

(constant) RENDERING_VERTRADIOBUTTON :string

Description:
  • Rendering vertical radio button(s).

Rendering vertical radio button(s).

Type:
  • string

(constant) SEARCH_MONO :number

Description:
  • Searchable.

Searchable.

Type:
  • number

(constant) SEARCH_MULTI_CHECK :number

Description:
  • Searchable using check boxes.

Searchable using check boxes.

Type:
  • number

(constant) SEARCH_MULTI_LIST :number

Description:
  • Searchable using list box.

Searchable using list box.

Type:
  • number

(constant) SEARCH_NONE :number

Description:
  • Not searchable.

Not searchable.

Type:
  • number

(constant) SEARCH_PERIOD :number

Description:
  • Searchable using period.

Searchable using period.

Type:
  • number

(constant) TRUE :string

Description:
  • True value

True value

Type:
  • string

(constant) TYPE_BIGDECIMAL :number

Description:
  • Big decimal type.

Big decimal type.

Type:
  • number

(constant) TYPE_BOOLEAN :number

Description:
  • Boolean type.

Boolean type.

Type:
  • number

(constant) TYPE_COLOR :number

Description:
  • Color type.

Color type.

Type:
  • number

(constant) TYPE_DATE :number

Description:
  • Date type.

Date type.

Type:
  • number

(constant) TYPE_DATETIME :number

Description:
  • Date and time type.

Date and time type.

Type:
  • number

(constant) TYPE_DOC :number

Description:
  • Document type

Document type

Type:
  • number

(constant) TYPE_EMAIL :number

Description:
  • Email type.

Email type.

Type:
  • number

(constant) TYPE_ENUM :number

Description:
  • Single enumerated (list of values) type.

Single enumerated (list of values) type.

Type:
  • number

(constant) TYPE_ENUM_MULTI :number

Description:
  • Multiple enumerated (list of values) type.

Multiple enumerated (list of values) type.

Type:
  • number

(constant) TYPE_EXTFILE :number

Description:
  • External file reference type.

External file reference type.

Type:
  • number

(constant) TYPE_FLOAT :number

Description:
  • Float type.

Float type.

Type:
  • number

(constant) TYPE_GEOCOORDS :number

Description:
  • Geo coordinates type.

Geo coordinates type.

Type:
  • number

(constant) TYPE_HTML :number

Description:
  • HTML content type.

HTML content type.

Type:
  • number

(constant) TYPE_ID :number

Description:
  • Internal ID (foreign key) type.

Internal ID (foreign key) type.

Type:
  • number

(constant) TYPE_IMAGE :number

Description:
  • Image type.

Image type.

Type:
  • number

(constant) TYPE_INT :number

Description:
  • Integer type.

Integer type.

Type:
  • number

(constant) TYPE_LONG_STRING :number

Description:
  • Long string (unlimited) type.

Long string (unlimited) type.

Type:
  • number

(constant) TYPE_NOTEPAD :number

Description:
  • Notepad (incremental long text) type.

Notepad (incremental long text) type.

Type:
  • number

(constant) TYPE_OBJECT :number

Description:
  • Object type.

Object type.

Type:
  • number

(constant) TYPE_PASSWORD :number

Description:
  • Password type.

Password type.

Type:
  • number

(constant) TYPE_PHONENUM :number

Description:
  • Phone number type.

Phone number type.

Type:
  • number

(constant) TYPE_REGEXP :number

Description:
  • Regular expression type.

Regular expression type.

Type:
  • number

(constant) TYPE_STRING :number

Description:
  • String type.

String type.

Type:
  • number

(constant) TYPE_TIME :number

Description:
  • Time type.

Time type.

Type:
  • number

(constant) TYPE_URL :number

Description:
  • URL type.

URL type.

Type:
  • number

(constant) UPD_ALWAYS :number

Description:
  • Updatable in lists and forms.

Updatable in lists and forms.

Type:
  • number

(constant) UPD_FORM_ONLY :number

Description:
  • Updatable in forms only.

Updatable in forms only.

Type:
  • number

(constant) UPD_LIST_ONLY :number

Description:
  • Updatable in lists only.

Updatable in lists only.

Type:
  • number

(constant) UPD_READ_ONLY :number

Description:
  • Not updatable.

Not updatable.

Type:
  • number

(constant) VIEW_TYPE :Object

Description:
  • View item types

View item types

Type:
  • Object

(constant) VIS_BOTH :number

Description:
  • Visible in lists and forms.

Visible in lists and forms.

Type:
  • number

(constant) VIS_FORBIDDEN :number

Description:
  • Forbidden on UI

Forbidden on UI

Type:
  • number

(constant) VIS_FORM :number

Description:
  • Visible in forms.

Visible in forms.

Type:
  • number

(constant) VIS_HIDDEN :number

Description:
  • Not visible.

Not visible.

Type:
  • number

(constant) VIS_LIST :number

Description:
  • Visible in lists.

Visible in lists.

Type:
  • number

(constant) VIS_NOT :number

Description:
  • Not visible (alias to VIS_HIDDEN).

Not visible (alias to VIS_HIDDEN).

Type:
  • number

appinfo

Description:
  • Application info data.

    • name: Application name
    • version: Application version
    • platformversion: Platform version
    • encoding: Encoding
    • server: Server vendor
    • Etc.

Application info data.

  • name: Application name
  • version: Application version
  • platformversion: Platform version
  • encoding: Encoding
  • server: Server vendor
  • Etc.

authToken

Description:
  • Server side session authentication token.

Server side session authentication token.

authTokenExpiryDate

Description:
  • Server side session authentication token expiry date

Server side session authentication token expiry date

grant

Description:
  • Grant data.

    • login: User login
    • firstname: User first name
    • lastname: User last name
    • responsibilities: User active responsibilites array
    • Etc.

Grant data.

  • login: User login
  • firstname: User first name
  • lastname: User last name
  • responsibilities: User active responsibilites array
  • Etc.
Description:
  • Menu data.

Menu data.

news

Description:
  • News array. Use news["<code>"] to get a news object)

News array. Use news["<code>"] to get a news object)

sessionId

Description:
  • Server side session identifier.

Server side session identifier.

sysparams

Description:
  • System parameters array. Use sysparams["<name>"] to get a system parameter value.

System parameters array. Use sysparams["<name>"] to get a system parameter value.

texts

Description:
  • Texts. Use texts["<code>"] to get a text value.

Texts. Use texts["<code>"] to get a text value.

views

Description:
  • View definitions

View definitions

Methods

T(code, plural) → {string}

Description:
  • Get text value (alias to getText).

Parameters:
Name Type Description
code string

Text code

plural boolean

True to get the plural value if known

Returns:

Text value

Type
string

base64Decode(s) → {string}

Description:
  • Decode a base64 string to string

Parameters:
Name Type Description
s string

Base64-encoded string

Returns:

Decoded string

Type
string

base64Encode(s) → {string}

Description:
  • Encode a string to base64

Parameters:
Name Type Description
s string

Input string

Returns:

Base64-encoded string

Type
string

base64EncodeArrayBuffer(b) → {string}

Description:
  • Encode an array buffer (such as got from a local file read) to to base64

Parameters:
Name Type Description
b Array

Array buffer

Returns:

Base64-encoded string

Type
string

bookmark(cbk, method, params)

Description:
  • Bookmark service

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

method string

show, add, delete, toggle

params Object

method parameters data or show

changeLang(cbk, lang, params)

Description:
  • Change user's language

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

lang string

language code (FRA, ENU...)

params Object

Optional parameters

Properties
Name Type Description
pref boolean

Update also the preferred language

async boolean

Asynchronous call (use default if absent)?

clearCache(obj)

Description:
  • Remove objects from cache

Parameters:
Name Type Description
obj

Object name or business object

clientTabId(id)

Description:
  • Identifiy the client tab in sessionStorage

Parameters:
Name Type Description
id string

optinal Id to force the value (null to remove)

Returns:

tab unique Id

contentURL(file)

Description:
  • Returns content URL.

Parameters:
Name Type Description
file string

Content file name

dataURL(doc, thumb)

Description:
  • Returns local data URL (e.g. suitable for src of img tags).

Parameters:
Name Type Description
doc

Document with mime type and base64 image or thumbnail

thumb

Return document thumbnail?

debug(msg)

Description:
  • Debug handler

Parameters:
Name Type Description
msg string

Message

dispositionResourceURL(code, type)

Description:
  • Returns disposition resource URL.

Parameters:
Name Type Description
code string

Resource code

type string

Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)

documentURL(object, field, rowId, docId, cdisp)

Description:
  • Returns document URL.

Parameters:
Name Type Description
object Object | string

Object name or object

Properties
Name Type Description
object string

Object name

field string

Field name

rowId string

Row ID

docId string

Document name

field string

Field name

rowId string

Object record row ID

docId string

Document ID (can be omitted then a lookup is done on record matching rowId)

cdisp string

Disposition: attachment or inline (defaults to inline)

editor(cbk, service, params, post)

Description:
  • Editor services

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

service string

prefs|open|close|save|completion|move|explore

params params

Optional parameters { object, inst, rowId, field, scope, type, cls, prefix, force, from, to, explore, javadoc, cls, pkg }

post Object

Optional post data with document

error(msg)

Description:
  • Error handler

Parameters:
Name Type Description
msg string

Message

firebase(cbk, data, params)

Description:
  • Firebase service to send mobile notification

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

data Object

Parameters

Properties
Name Type Description
title string

Optional title

message string

Message body

to Object

{users, groups} list of logins or groups, or 'all' to notify all users

token string

Optional refresh device token

oldtoken string

Optional previous token to remove

params Object

parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

follow(cbk, params)

Description:
  • Social follow service.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

parameters

Properties
Name Type Description
method string

follow|unfollow|accept|deny|search

param string

related userId or search request

object string

optional User object to use

all boolean

optional to search all authors or not

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getAppInfo(cbk, params)

Description:
  • Loads application info data.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getAsync() → {boolean}

Description:
  • Is globally asynchronous?

Returns:

True if is globally asynchronous

Type
boolean

getBusinessObject(obj, objInstName)

Description:
  • Get a new business object.

Example
// app is a Simplicite.Ajax instance
const obj = app.getBusinessObject("MyObject");
// other instance of obj
const tmp = app.getBusinessObject("MyObject", "tmpObj");
Parameters:
Name Type Description
obj

Object name or business object

objInstName

Optional instance name (default the_ajax_<object name>)

getBusinessProcess(name)

Description:
  • Get a new business process.

Example
// app is a Simplicite.Ajax instance
const pcs = app.getBusinessProcess("MyProcess");
Parameters:
Name Type Description
name

Business process name

getErrorMessage(err)

Description:
  • Get the message in error

Parameters:
Name Type Description
err Object

with message, messages or description

getExternalObject(cbk, name, params)

Description:
  • Loads external object definition.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

name string

External object name

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getExternalObjectURL(name, params, embedded)

Description:
  • External object URL.

Parameters:
Name Type Description
name string

Object name

params Object

Optional parameters (object or string)

embedded boolean

True to get a relative URL, false to get the full http URL (loadURL will create an iframe)

getGateway() → {string}

Description:
  • Get gateway

Returns:

Gateway (one of GATEWAY_* constants)

Type
string

getGrant(cbk, params)

Description:
  • Loads grant data.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
inlinePicture boolean

Inline picture (false if absent or undefined)

web boolean

true to load menu, texts and sysparams

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getIconURL(name)

Description:
  • Icon URL

Parameters:
Name Type Description
name string

Resource icon name

getMenu(cbk, params)

Description:
  • Loads menu data.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getNews(cbk, params)

Description:
  • Loads news.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
count boolean

Return news count only (false if absent or undefined)

inlineImages boolean

Inline news image (false if absent or undefined, not taken into account if count is true)

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getResourceURL(code, type, object, objId)

Description:
  • Returns Object resource URL.

Parameters:
Name Type Description
code string

Resource code

type string

Resource type (IMG=image (default), ICO=Icon, CSS=stylesheet, JS=Javascript, HTML=HTML)

object string

Object name: ObjectInternal or ObjectExternal (for Disposition use dispositionResourceURL)

objId string

Object row ID (not the resource row ID)

getStandardError(level, message, details)

Description:
  • JSON message

Parameters:
Name Type Description
level string
message string
details Object

getSysInfo(cbk, params)

Description:
  • Loads system info data.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getSysParam(cbk, name, params)

Description:
  • Get system parameter value.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

name string

System parameter name

params Object

Optional parameters

Properties
Name Type Description
force boolean

Force read system parameter value from the database?

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getSysParams(cbk, params)

Description:
  • Loads system parameters.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getText(code, plural) → {string}

Description:
  • Get text value.

Parameters:
Name Type Description
code string

Text code

plural boolean

True to get the plural value if known

Returns:

Text value

Type
string

getTexts(cbk, params)

Description:
  • Loads texts.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getTimeout() → {string}

Description:
  • Get timeout

Returns:

Timeout

Type
string

getUserInfo(cbk, login, params)

Description:
  • Loads basic user data (login, name, email, picture).

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

login string

User login

params Object

Optional parameters

Properties
Name Type Description
inlinePicture boolean

Inline picture (false if absent or undefined)

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

getView(cbk, name, params)

Description:
  • Loads view definition.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

name string

View name

params Object

Optional parameters

Properties
Name Type Description
home boolean

Optional for home or panel instance (default true to get home object instances)

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

imageURL(object, field, rowId, docId, thumb)

Description:
  • Returns image URL.

Parameters:
Name Type Description
object string

Object name

field string

Field name

rowId string

Object record row ID

docId string

Document ID

thumb boolean

Return thumbnail image

indexsearch(cbk, request, params)

Description:
  • Search from index.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

request string

Index search request string

  • simple text with wildcards and operators
  • in:domain:xxx[:all] = to get recent objects in a specific domain 'xxx', 'all' or by default those updated by the user
  • in:docs:obj1[;obj2;obj3...] text = to search the text in joined documents of listed objects
params Object

Optional parameters

Properties
Name Type Description
inlineDocs boolean

Inline documents (false if absent or undefined, can be a boolean or an array of document fields to inline) ?

inlineThumbs boolean

Inline image documents thumbnails (false if absent or undefined) ?

inlineObjs boolean

Inline objects fields items (false if absent or undefined, can be a boolean or an array of object fields to inline) ?

metadata: boolean

gets the search engine metadata { indexed:[{name,label},...], withDocs:[{name,label},...] }

useFilter: boolean

apply user preference INDEX_OBJ_FILTER to limit search

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

info(msg)

Description:
  • Info handler

Parameters:
Name Type Description
msg string

Message

isFalse(value) → {boolean}

Description:
  • Returns true if value is 0|false|no|n

Parameters:
Name Type Description
value string

parameter value

Returns:

Is value false?

Type
boolean

isFirefox()

Description:
  • Is Firefox?

Returns:

True if is Firefox

isTrue(value) → {boolean}

Description:
  • Returns true if value is 1|true|yes|y

Parameters:
Name Type Description
value string

parameter value

Returns:

Is value true?

Type
boolean

isWebkit()

Description:
  • Is WebKit?

Returns:

True if is WebKit

isWinIE()

Description:
  • Is Windows Internet Explorer?

Returns:

True if is Windows Internet Explorer

login(success, failure, authToken, params)

Description:
  • Login (same as session()).

Parameters:
Name Type Description
success function

Optional function called when session init is successful (Promise.then if absent)

failure function

Optional function called when session init fails (Promise.catch if absent)

authToken string

Auth token to (re)use (in case of persistent tokens)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

scope string

Optional session scope

logout(success, failure, params)

Description:
  • Logout (in case of a persistent token it is deleted)

Parameters:
Name Type Description
success function

Optional function called when logout is successful (Promise.then if absent)

failure function

Optional function called when logout fails (Promise.catch if absent)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

messageToJson(msg)

Description:
  • Convert a textual backend message to json { code, text, level, field, label, error } or technical statement { redirect } or { javascript }

    • code: message code
    • text: optional contextual details
    • level: 'I'nfo, 'W'arning, 'E'rror, 'F'atal
    • field: optional field name of message
    • label: default text to display in user language
    • error: true when level is fatal or error
    • params: optional parameter key/value (suggest)
    • actions: optional call to actions
Parameters:
Name Type Description
msg

formatted backend message 'code:text#level#field#param:value' or 'redirect:url' or 'javascript:code'

module(cbk, params)

Description:
  • Module services

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

parameters

Properties
Name Type Description
row_id string

Module row ID

del string

Deletion action start|status

confirm boolean

Confirm deletion?

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

monitor(m, params, cbk)

Description:
  • Monitoring service

Parameters:
Name Type Description
m string | Object

Monitoring service or plain JSON object to store

params Object

Optional parameters { session }

cbk function

Optional callback for response

onExpiredSession(reason, callbackopt)

Description:
  • Handler when session has expired on server side, by default throws HTTP 401 in console. It can be overridden to return on the logon form in a UI context.

Parameters:
Name Type Attributes Description
reason Object

Expired reason

callback function <optional>

Callback to call if session can be restored silently

parseDateTimeValue(v) → {Date}

Description:
  • Parse a date time value into a Javascript Date

Parameters:
Name Type Description
v string

Date time value (YYYY-MM-DD HH:mm:ss)

Returns:

Javascript date

Type
Date

parseDateValue(v) → {Date}

Description:
  • Parse a date value into a Javascript Date

Parameters:
Name Type Description
v string

Date value (YYYY-MM-DD)

Returns:

Javascript date

Type
Date

randomString(len)

Description:
  • Random string

Parameters:
Name Type Description
len

Length

Returns:

Random string of specified length

resourceURL(resId)

Description:
  • Returns resource URL.

Parameters:
Name Type Description
resId string

Resource ID (e.g. taken from business object or external object resources list in metadata)

session(success, failure, authToken, params)

Description:
  • Session init (retrieves server side session identifier and auth token).

Parameters:
Name Type Description
success function

Optional function called when session init is successful (Promise.then if absent)

failure function

Optional function called when session init fails (Promise.catch if absent)

authToken string

Auth token to (re)use (in case of persistent tokens)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

scope string

Optional session scope

clientId string

Optional client Id

setAsync(async)

Description:
  • Set globally asynchronous (the UI needs to be asynchronous)

Parameters:
Name Type Description
async boolean

Asynchronous?

setDebugHandler(debugHandler)

Description:
  • Change default global debug handler.

Parameters:
Name Type Description
debugHandler

Debug handler function

setDebugHandlerActive(active)

Description:
  • Set default global debug handler active or inactive.

Parameters:
Name Type Description
active

Active status

setErrorHandler(errorHandler)

Description:
  • Change default global error handler.

Parameters:
Name Type Description
errorHandler

Error handler function

setErrorHandlerActive(active)

Description:
  • Set default global error handler active or inactive.

Parameters:
Name Type Description
active

Active status

setGateway(gateway, loginopt, passwordopt)

Description:
  • Set gateway and credentials

Parameters:
Name Type Attributes Description
gateway string

Gateway (one of GATEWAY_* constants)

login string <optional>

Login

password string <optional>

Password

setInfoHandler(infoHandler)

Description:
  • Change default global information handler.

Parameters:
Name Type Description
infoHandler

Information handler function

setInfoHandlerActive(active)

Description:
  • Set default global information handler active or inactive.

Parameters:
Name Type Description
active

Active status

setPassword(cbk, password, params)

Description:
  • Set password.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

password string

Password

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

setSysParam(cbk, name, value, save, params)

Description:
  • Set a user system parameter.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

name string

Parameter name

value string

Parameter value (if undefined parameter is unset)

save boolean

Save parameter in user parameters (if undefined parameter is not saved)

params Object

Optional parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

setTimeout(timeout)

Description:
  • Set timeout

Parameters:
Name Type Description
timeout number

Timeout (seconds)

setView(name, view)

Description:
  • Set a view in cache

Parameters:
Name Type Description
name string

View name

view Object

View definition

setWarningHandler(warningHandler)

Description:
  • Change default global warning handler.

Parameters:
Name Type Description
warningHandler

Warning handler function

setWarningHandlerActive(active)

Description:
  • Set default global warning handler active or inactive.

Parameters:
Name Type Description
active

Active status

social(cbk, params, post)

Description:
  • Social post service.

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

params Object

Optional parameters

Properties
Name Type Description
counters boolean

true to get counters without posts

object string

Optional object name

rowId string

Optional row ID

page number

Optional page to search, -1=no search

activity boolean

true to include activity message

level string

optional level filter

audit boolean

to list audit message only

del boolean

true to delete the post (default the service upsert the post)

like boolean

Optional true to like, false to unlike

status string

Optional status to update

follow boolean

true to get follow counters

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

post Object

optional post to save or delete { id, userId, message, pub, object, rowId }

syntax(cbk, data, params)

Description:
  • Syntax service: will return an object with the results

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

data Object

parameters

Properties
Name Type Description
type string

type of syntax service: field

objectid string

object id for field name

value Object

value to validate or transform

params Object

parameters

Properties
Name Type Description
async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

toDateTimeValue(d) → {string}

Description:
  • Parse a Javascript Date into a date time value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Date time value (YYYY-MM-DD HH-mm-ss)

Type
string

toDateValue(d) → {string}

Description:
  • Parse a Javascript Date into a date value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Date value (YYYY-MM-DD)

Type
string

toTimeValue(d) → {string}

Description:
  • Parse a Javascript Date into a time value

Parameters:
Name Type Description
d Date

Javascript date

Returns:

Time value (HH:mm:ss)

Type
string

treeview(cbk, name, params)

Description:
  • Treeview services

Parameters:
Name Type Description
cbk function

Optional function called when loading is completed (returns a Promise if absent)

name string

Treeview name

params Object

Optional parameters

Properties
Name Type Description
service string

metadata (default), page, getmenu, addmenu, delmenu

object string

optional object name

rowid string

optional object rowId

child string

child object of page service

child number

page number of page service

async boolean

Asynchronous call (use default if absent)?

error function

Custom error handler (unused by Promise with catch)

warning(msg)

Description:
  • Warning handler

Parameters:
Name Type Description
msg string

Message

winIEVersion() → {number}

Description:
  • Get Windows Internet Explorer version

Returns:

Version

Type
number