Skip to main content

Interface

You can use the Interface to enable an app to trigger certain actions on the Facilio user interface. With these functions, an app can navigate to the cetain page, show dialog boxes and notifications.

openSummary#

app.interface.openSummary(options) - Open module record summary.


JSON Params

KeyDescription
moduleFacilio module link name. (ex: workorder, alarm, asset, etc…)
idId of the opening record.

Example

let options = {  module: "workorder",  id: 1112334,};app.interface.openSummary(options);

openListView#

app.interface.openListView(options) - Open module records list view with or without filters.


JSON Params

KeyDescription
moduleFacilio module link name. (ex: workorder, alarm, asset, etc…)
viewLink name of the view. Default all.
filtersFilters json to show only matching records. (Optional)

Example

let options = {  module: "alarm",  view: "active",  filters: {    message: { operator: "contains", value: "Too cold" },  },};app.interface.openListView(options);

openControlDialog#

app.interface.openControlDialog(options) - Function to open control dialog for controling assets realtime.


JSON Params

KeyDescription
parentIdAsset/Space Id to control.
readingIdControllable reading id.

Example

let options = {  parentId: 234234,  readingId: 1111,};app.interface  .openControlDialog(options) // will return Javascript Promise  .then((response) => {    // control success  })  .catch((error) => {    // error in control  });

notify#

app.interface.notify(notifyOptions) - Is used to notify messages on the Facilio interface.


Example

const notifyOptions = {  title: ‘Fire alarm detected’,  message: ‘Fire alarm detected at some location,  type: ‘warning’,  //success/warning/info/error  duration: 2000,  // in milliseconds  position: ‘top-right’  //top-right/top-left/bottom-right/bottom-left};
// (optional) set link to notificationnotifyOptions.link = {url: ‘https://<someurl>.com’, target: ‘_blank’};
app.interface.notify(notifyOptions);