alert ( opts: Object )

Shows an alert dialog to the user.

Parameters
Name Type Description
opts Object

Optional object for configuring the alert.

Properties
Name Type Description
message String The alert message.
ok Function Callback function when the dialog is closed.

ask ( options: Object )

Ask the user to select one of a set of options

Parameters
Name Type Description
options Object

options Options

Properties
Name Type Description
title String options.title Dialog title
options Arrau property (String), an optional 'icon'-property (String) and an optional 'onClick'-property (function)

back ( )

Goes back to the previous view.

closeDialog ( data: Object )

Closes the current dialog.

Parameters
Name Type Description
data Object

data Optional data to pass back.

confirm ( options: Object )

Shows a Yes/No confirmation dialog to the user.

Parameters
Name Type Description
options Object

Configuration object.

Properties
Name Type Description
message String The message to display in the dialog
title String The message to title in the dialog
ok Function Callback function when the user presses 'OK'
cancel Function Callback function when the user closes the dialog without pressing OK.

continueTo ( nextView: String )

Changes the currently shown view. Uses existing form data as the data for the new view.

Parameters
Name Type Description
nextView String

The id of the next view.

create ( record: Record , opts: Object ) →{ Promise }

Create a record

Parameters
Name Type Description
record Record

record to create

opts Object

opts Options

Properties
Name Type Description
onSuccess Function opts.onSuccess Callback function for success
onError Function opts.onError Callback function for error

createDocumentRecord ( modelName: String , data: Object , file: Object ) →{ Promise }

Creates a DocumentRecord-object, this will upload the associated file-data and then create a DocumentRecord-object

Parameters
Name Type Description
modelName String

modelName Name of model to create record of

data Object

attributes and related records.

file Object

file File options

Properties
Name Type Description
data Object file.data File contents (String or Blob)
filename String file.filename Filename
contentType String type

createForm ( options: Object ) →{ Form }

Create a new form in the current view

Parameters
Name Type Description
options Object

options Options

Properties
Name Type Description
parent String options.parent Name of parent form
relation String options.relation Name of relation to connect to

createQueryBuilder ( options: Object ) →{ QueryBuilder }

Creates a query-builder

Parameters
Name Type Description
options Object

options Options

Properties
Name Type Description
from String options.from Name of model to query

createRecord ( modelName: String , data: Object , file: Object ) →{ Record }

Creates a Record-object

Parameters
Name Type Description
modelName String

modelName Name of model to create record of

data Object

attributes and related records.

file Object

records

Properties
Name Type Description
data Object file.data File contents
filename String file.filename Filename
contentType String type

createTemplateContext ( opts: Object ) →{ TemplateContext }

Creates a template context using the specified data and records.

Parameters
Name Type Description
opts Object

Optional configuration object

Properties
Name Type Description
data Object
records Array
Returns

The created context.

createTransaction ( ) →{ Transaction }

Creates a new transaction wrapping a set of database-operations.

createWidget ( opts: Object , value: Object ) →{ Promise }

Creates a new widget using the specified data.

Parameters
Name Type Description
opts Object

Configuration object.

Properties
Name Type Description
attachPoint Object The point to attach the widget to (optional).
parent Object A parent widget (optional).
widget Object The widget data.
value Object

Value to set on the newly created widget

createWindow ( opts: Object )

Creates a HTML dialog window.

Parameters
Name Type Description
opts Object

opts Configuration object.

Properties
Name Type Description
url String opts.url
content String opts.content
template String opts.template
data Object opts.data
records Array opts.records

delete ( record: Record , opts: Object ) →{ Promise }

Delete a record

Parameters
Name Type Description
record Record

record to delete

opts Object

opts Options

Properties
Name Type Description
onSuccess Function opts.onSuccess Callback function for success
onError Function opts.onError Callback function for error

dial ( number: String )

Dial a phone-number

Parameters
Name Type Description
number String

The phone number to dial.

downloadVirtualFile ( opts: Object )

Creates and downloads a virtual file using the provided data.

Parameters
Name Type Description
opts Object

Configuration object

Properties
Name Type Description
data Object The file data
fileType String The file type
fileName String The filename

executeTemplate ( opts: Object ) →{ String }

Compiles a template string.

Parameters
Name Type Description
opts Object

Configuration object

Properties
Name Type Description
template String The template name
Returns

The compiled template.

exportToExcel ( Array: Array , Options: Object ) →{ Promise }

Exports an array of records in Excel-format

Parameters
Name Type Description
Array Array

Array of records

Options Object

Options

get ( model: Model , id: String , options: Object ) →{ Promise }

Get a record

Parameters
Name Type Description
model Model

model Model to get record of

id String

id ID of record to get

options Object

options Options

Properties
Name Type Description
relations String separated list of relations to load

getApplianceId ( ) →{ String }

Gets the ID of the appliance this application is running on

getApplianceTags ( ) →{ Array }

Returns the tags of this appliance (or an empty array if the app is not running on an appliance)

getAppVersion ( ) →{ Number }

Gets the version of the application

getAudio ( name: String )

Get an application resource as an audio-object by name or ID

Parameters
Name Type Description
name String

Name or ID of resource to get

getConfigParam ( name: String ) →{ ConfigurationParameter }

Returns a configuration parameter using the specified name, or null if no such parameter exists.

Parameters
Name Type Description
name String

The name of the parameter.

getCountry ( ) →{ String }

Returns the country of the current user

Returns

1 country code

getData ( name: String ) →{ Object }

Returns previously stored clientside data.

Parameters
Name Type Description
name String

The identifier used when storing the data.

Returns

The data, or the default value if none was found.

getDataFunctions ( ) →{ DataFunctions }

Gets the Data-API

getDateFunctions ( ) →{ DateFunctions }

Gets the Date-API

getDeviceInfo ( ) →{ Object }

Gets an object with properties describing the current device

getForm ( formId: String ) →{ Form }

Fetches a form from the current view using the provided form id.

Parameters
Name Type Description
formId String

The id of the form to return.

Returns

The form, or null if no form was found.

getGeneralFunctions ( ) →{ GeneralFunctions }

Gets the General API

getGeoLocation ( ) →{ GeoFunctions }

Gets the Geo API

getIntegration ( integration: String , options: Object )

Gets the API of an integration-module

Parameters
Name Type Description
integration String

The name of the integration to get

options Object

options

Properties
Name Type Description
timeout Number Timeout for function invocations (in seconds). Default is 120.

getLanguage ( ) →{ String }

Returns the language preferred by the current user

Returns

1 language code

getMessageBus ( ) →{ MessageBus }

Gets the messagebus

getNumericFunctions ( ) →{ NumericFunctions }

Gets the Numeric API

getOrganization ( ) →{ Object }

Returns the current organization

getParameter ( name: String ) →{ QueryParameter }

Returns a query parameter using the specified name.

Parameters
Name Type Description
name String

The name of the parameter.

getPdf ( opts: Object ) →{ Promise }

Generates and downloads a pdf file

Parameters
Name Type Description
opts Object

opts Options

Properties
Name Type Description
timeout Number opts.timeout Timeout in ms
onSuccess Function opts.onSuccess Callback function for success
onError Function opts.onError Callback function for error

getPlatformVersion ( ) →{ String }

Gets the version of the Appivo platform

getPlugin ( plugin: String )

Gets the API of a plugin.

Parameters
Name Type Description
plugin String

The name of the plugin to get.

getPrivilegesFor ( record: Record , opts: Object )

Get all privileges for a certain record

Parameters
Name Type Description
record Record

record to get privileges for

opts Object

opts Options

Properties
Name Type Description
onSuccess Function opts.onSuccess Callback function for success
onError Function opts.onError Callback function for error

getQueryHandle ( name: String ) →{ QueryHandle }

Returns a handle to a query.

Parameters
Name Type Description
name String

name The name of the Query Handle.

getResource ( name: String )

Get an application resource by name or ID

Parameters
Name Type Description
name String

Name or ID of resource to get

getString ( name: String , vars: Object )

Returns the localization string of the given name.

Parameters
Name Type Description
name String

name The name of the localization string.

vars Object

vars Variables to use when localizing the string

getStrings ( ) →{ Array }

Returns an array of the app's localization strings.

Returns

An holding all of the app's strings.

getTemplate ( id: String ) →{ Object }

Returns the template with the specified id.

Parameters
Name Type Description
id String

The desired template's id.

getTenantId ( ) →{ ID }

Returns the ID of the current user's tenant.

getURI ( url: String ) →{ String }

Returns the full URI of the specified URL.

Parameters
Name Type Description
url String
Returns

The full URI

getUser ( load: Boolean ) →{ User }

Returns the current user.

Parameters
Name Type Description
load Boolean

load Force loading user from backend. This will make the function return a promise.s

getView ( ) →{ View }

Returns a reference to the current view.

getViewResponse ( ) →{ Object }

Gets the returned data from the previously visited view (if any)

Returns

data returned from previous view or null if none is available

getWidget ( widgetId: String ) →{ BaseWidget }

Fetches a widget from the current view using the provided widget id.

Parameters
Name Type Description
widgetId String

The widget id of the widget to return.

Returns

The widget, or null if no widget was found.

hasFeature ( name: String ) →{ Boolean }

Checks if the user has the specified feature enabled.

Parameters
Name Type Description
name String

The feature name

Returns

True if the user has the feature enabled, otherwise false.

hideSpinner ( )

Hides the loading indicator

http ( opts: Object ) →{ Promise }

Send an http-request

Parameters
Name Type Description
opts Object

opts Request options

Properties
Name Type Description
url String opts.url URL or path to send request to
method String method to use (GET, PUT, POST, DELETE)
headers String pairs
data Object opts.data Data to put in the request body, if applicable. Can be a string or an object.

importFromExcel ( File: File, Options: Object ) →{ Promise }

Imports records from an Excel-file

Parameters
Name Type Description
File File

File to import from

Options Object

Options

invoke ( funcName: String , args: Object ) →{ Object }

Invokes a function defined on the current view.

Parameters
Name Type Description
funcName String

The name of the function.

args Object

Object with named arguments to pass to the function. These will be available via the args-parameter passed to the function.

Returns

The functions return value, if any.

invokeAction ( opts: Object ) →{ Promise }

Invokes an action

Parameters
Name Type Description
opts Object

Object holding configuration for the invokation.

Properties
Name Type Description
action String The name of the action to invoke.
record Object The record to send to the action
data Object Arbitrary data to send to the action
Returns

A dojo deferred object (See the Dojo documentation.

invokePlatformService ( opts: Object ) →{ Promise }

Invokes a platform service

Parameters
Name Type Description
opts Object

Options

Properties
Name Type Description
service Object Name of platform-service to invoke
timeout Object Timeout in seconds. Max amount of time to wait for service-response.

invokeService ( options: Object ) →{ Promise }

Invokes a server-side REST rule.

Parameters
Name Type Description
options Object

Object holding configurations for the invokation.

Properties
Name Type Description
service String The name of the rule to invoke.
parameters Object Object of query parameters and their values.
data Object Object containing data to send.
Returns

A dojo deferred object (See the Dojo documentation.

isAppliance ( ) →{ Boolean }

Checks whether this application is running on an appliance

isForcedOffline ( ) →{ Boolean }

Checks whether the device is currently forced offline,

Returns

True if the device is forced offline

isHybrid ( ) →{ Boolean }

Checks whether we are running in the context of a hybrid mobile app

Returns

True if the current user is in the context of hybrid mobile app

isLoggedIn ( ) →{ Promise }

Checks whether the user is logged in or not. Note that this method returns a Promise that resolves to a boolean.

isMobile ( ) →{ Boolean }

Checks whether the current user is on a mobile device.

Returns

True if the current user is on a mobile device, otherwise false.

isOffline ( ) →{ Boolean }

Checks whether the device is currently offline,

Returns

True if the device is offline

isUpdateAvailable ( ) →{ Promise }

Check if an upgrade is available

isViewAccessible ( ) →{ Boolean }

Checks whether the user has the right to view the specified view.

Returns

True if the user is allowed to view the specified view, otherwise false.

jsonpath ( path: String , json: Object , opts: Object ) →{ Array }

Queries a json-document using JSON-path

Parameters
Name Type Description
path String

path The path to query for

json Object

json Document to execute query on

opts Object

opts Options

Returns

Array elements found

loadResource ( options: Object )

Loads an application resource as a JSON-object

Parameters
Name Type Description
options Object

Options

Properties
Name Type Description
name String Resource name

log ( The: String )

Logs a message to the console.

Parameters
Name Type Description
The String

The messag e to log.

login ( opts: Object ) →{ Promise }

Login a user

Parameters
Name Type Description
opts Object

opts Options

Properties
Name Type Description
username String opts.username User name
password String opts.password Users password
code String opts.code Users Two Factor Code
remember Boolean opts.remember Whether to remember this user
restricted Boolean opts.restricted Only allow logins to the current tenant (defaults to true)
path Object path to navigate to ("app", "ui", "view" and "record" properties can be passed)

logout ( ) →{ Promise }

Logout the user

mailTo ( email: String )

Creates and opens a mailto: link.

Parameters
Name Type Description
email String

The email adress to use for the link.

message ( options: Object )

Shows a message notification to the user.

Parameters
Name Type Description
options Object

Optional parameter for configuring the message.

Properties
Name Type Description
delay Number A delay in milliseconds before the message notification is closed.
message String The notification message.
dismissable Boolean Decides if the message is dismissable.

notify ( options: Object )

Shows a success/error notification to the user.

Parameters
Name Type Description
options Object

Contains the configuration for the notification.

Properties
Name Type Description
type string The type of notification to display. This value must be either 'success', 'error', 'info' or 'default'. Append '-light' for lighter appearance eg 'success-light'.
message string The notification message.
position string The position to display notification. This value must be top/bottom left/center/right with the format of 'bottom-left', 'top-center'.
delay Number The time in seconds until the notification is automatically closed.

openDialog ( dialog: String , data: Record , opts: Object )

Opens a dialog view.

Parameters
Name Type Description
dialog String

The id of the dialog view.

data Record

An optional record that is used to populate form-connected widgets in the dialog.

opts Object

An object allowing for additional configurations.

Properties
Name Type Description
onDone Function Callback function when the dialog is closed.

openFile ( A: Record ) →{ Promise }

Open a file for viewing

Parameters
Name Type Description
A Record

record to view

playSound ( name: String )

Plays the specified sound resource

Parameters
Name Type Description
name String

The name of the sound resource.

prompt ( opts: Object )

Shows a prompt dialog to the user. The prompt dialog prompts the user for some information.

Parameters
Name Type Description
opts Object

Configuration object.

Properties
Name Type Description
message String The message to display in the dialog.
value String Default value for the input field.
ok Function Callback function when the user presses ok.
cancel Function Callback function when the user closes the dialog without pressing ok.

removeAllForms ( )

Remove all dynamically created forms

removeForm ( id: String )

Remove a dynamically created form

Parameters
Name Type Description
id String

id ID of form to remove

renderString ( template: String , data: Object ) →{ String }

TODO

Parameters
Name Type Description
template String

Template to render

data Object

Variables to use when rendering the template

replaceTerm ( name: String , vars: Object )

TODO

Parameters
Name Type Description
name String
vars Object

scheduleTask ( options: Object ) →{ String }

Schedules a task to be performed in set intervals

Parameters
Name Type Description
options Object

Configuration object

Properties
Name Type Description
callback Function The task to be performed.
cancel Function Callback when the task is cancelled.
name String An identifier for the task.
interval Number The interval (in milliseconds) between each task run.
repeat Boolean Specifies whether the task should be repeated after its first run or not.
Returns

The id of the task. This is needed to stop the task.

setData ( name: String , value: Object , scope: String )

Stores clientside data.

Parameters
Name Type Description
name String

An identifier for the data. Must be specified when loading the data again.

value Object

The value to store.

scope String

The availability scope of the data ('global' or 'persistent'). By default data is scoped to the current view only, global-scope means it will be available in all views but not persisted - persistent means it is global and persisted.

setUI ( ui: Object , view: String , data: Object , query: Query)

Changes the currently shown ui.

Parameters
Name Type Description
ui Object

View Object

Properties
Name Type Description
ui String View id
transition String for mobiles
view String

An optional View id that should be navigated to

data Object

An optional record that is used to populate forms in the new view.

query Query

Optional custom data to pass to the view

setView ( view: Object , data: Object , query: Query)

Changes the currently shown view.

Parameters
Name Type Description
view Object

View Object

Properties
Name Type Description
view String View id
transition String for mobiles
data Object

An optional record that is used to populate forms in the new view.

query Query

Optional custom data to pass to the view

showSpinner ( )

Shows the loading indicator

SMSTo ( tel: String )

Sends an SMS to the specified number

Parameters
Name Type Description
tel String

The phone number to send to.

unscheduleTask ( tid: String )

Stops a scheduled task.

Parameters
Name Type Description
tid String

The id that was returned when scheduling the task.

update ( record: Record , opts: Object ) →{ Promise }

Update a record

Parameters
Name Type Description
record Record

record to update

opts Object

opts Options

Properties
Name Type Description
onSuccess Function opts.onSuccess Callback function for success
onError Function opts.onError Callback function for error

updateApp ( ) →{ Promise }

Upgrade the application

uploadFile ( data: Object , options: Object ) →{ Promise }

Upload a file

Parameters
Name Type Description
data Object

data contents of file to upload

options Object

upload options

Properties
Name Type Description
filename String options.filename Name of the file to upload (defaults to file.text)
contentType String type of the file (defaults to text/plain)
lastModifiedDate String options.lastModifiedDate