messageExpression

An com.arcgismaps.arcade.ArcadeExpression that controls the notification details when a Geotrigger is met. The expression uses the Arcade language to generate notification information that can be:

  • a string literal that is the same for all notifications relating to this Geotrigger

  • information that is specific to the attributes of objects that met the Geotrigger

The expression is evaluated whenever the Geotrigger condition is met, in order to populate the GeotriggerNotificationInfo.message property. Display this message to alert the user that the Geotrigger condition has been met. Note that the expression cannot be changed when the GeotriggerMonitor is running.

For example, with a FenceGeotrigger, using the following expression:

"You have " + $fencenotificationtype + " " + $fencefeature.area_name

returns the GeotriggerNotificationInfo.message "You have entered Area A", where "area_name" is an attribute field on the FenceGeotriggerNotificationInfo.fenceGeoElement.

Optionally, the expression can return extra properties in addition to the message. For example, it could produce another string, suitable for logging to a database. To supply additional properties, write an arcade expression that evaluates to a dictionary of key value pairs.

For example, this expression results in a GeotriggerNotificationInfo.message of: "Hello world" and a GeotriggerNotificationInfo.actions list of either "startTracking" or "stopTracking".

var action = IIf($fencenotificationtype == 'enter', 'stopTracking', 'startTracking'); return { 'message': 'Hello world', 'actions': action }

The com.arcgismaps.arcade.ArcadeExpression must evaluate to either a string or a dictionary; see com.arcgismaps.arcade.ArcadeExpression.returnType. Note that this property is an com.arcgismaps.arcade.ArcadeExpression object, rather than a string.

For more information on the available profile variables and functions for creating the Geotrigger.messageExpression, see the "Geotrigger Notification" profile at https://developers.arcgis.com/arcade/profiles/.

Since

200.1.0