Skip to main content

Actions

Actions are configurable reactions to a button click for a specific event. An example of an action is a "Get Directions" action link which will present the user with a button to launch a URL:

actions: [
{
title: 'Go to headquarters',
type: 'link',
url: 'https://rizing.com',
target: '_blank' // <-- optional target.
}
];

Action Types

There are various types of actions that can be configured.

The link action type will open a URL. The attributes of the feature that was clicked on can be used as "tokens" within the link URL.

actions: [
{
title: 'Get Directions',
type: 'link',
url: 'https://maps.google.com?q={CITY_CODE}'
target: '_blank' // <-- optional target.
}
];

Post Message

A post-message action will trigger an event using the postMessage API. The event will be fired on the main window, on the parent window (if applicable), and any integration iframes that are currently open within the application.

actions: [
{
title: 'View Work Order',
type: 'post-message',
eventName: 'view-work-order-event'
}
];

The following payload will be sent within the event message:

actions: [
{
layerId: '1234', // The layer ID that the action was taken on
feature: {...}, // The feature that the action was taken on
gpsPosition: {latitude: 0, longitude:0, ...}, // The current GPS position (if tracking)
virtualPosition: {x: 0, y:0, m:0, ...}, // The current virtual position (if tracking)
}
];

NativeScript Event

The NativeScript action type will trigger a special NativeScript event that is meant to be used by host applications, built using NativeScript, and are integrating with Omni (host Omni in a webview).

The following example will emit a NativeScript event named ViewWorkOrder up to the host application.

actions: [
{
title: 'View Work Order',
type: 'native-script-event',
eventName: 'ViewWorkOrder'
}
];

The emitted event will have the following payload:

{
layerId: '1234', // The layer ID that the action was taken on
feature: {...}, // The feature that the action was taken on
gpsPosition: {latitude: 0, longitude: 0, ...}, // The current GPS position (if tracking)
virtualPosition: {x: 0, y: 0, m: 0, ...}, // The current virtual position (if tracking)
}