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.
#
openSummaryapp.interface.openSummary(options)
- Open module record summary.
JSON Params
Key | Description |
---|---|
module | Facilio module link name. (ex: workorder, alarm, asset, etc…) |
id | Id of the opening record. |
Example
let options = { module: "workorder", id: 1112334,};app.interface.openSummary(options);
#
openListViewapp.interface.openListView(options)
- Open module records list view with or without filters.
JSON Params
Key | Description |
---|---|
module | Facilio module link name. (ex: workorder, alarm, asset, etc…) |
view | Link name of the view. Default all. |
filters | Filters 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);
#
openControlDialogapp.interface.openControlDialog(options)
- Function to open control dialog for controling assets realtime.
JSON Params
Key | Description |
---|---|
parentId | Asset/Space Id to control. |
readingId | Controllable 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 });
#
notifyapp.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);