The messages profile defines what message to show to the end user. It is triggered by changes to dependent layers which are being watched, or by other application changes.

Profile variables

Variable nameTypeDescription
$mapFeatureSetCollectionThe list of layers in the web map. Can be used with the FeatureSetByName or FeatureSetById function to get a particular layer in the map. This can then be queried.
$userIdTextThe unique user ID of the editor who is logged into the application.
$userNameTextThe full name of the editor who is logged into the application.
$userIdentityTextProvides a credential instance. This can be used when accessing external layers with the FeatureLayer function. The credentials represent the user’s logged in credentials.
$sessionDictionaryA dictionary containing key value pairs. The dictionary contains all the session variables that have been configured in the app. When the application first launches, the user will be asked for values for the session variables. They can also (if configured) change session variables in the application. This provides programmatic access to the user’s choices / settings.
$selectionFeatureSetCollectionThe list of layers in the web map. Can be used with the FeatureSetByName or FeatureSetById function to get a particular layer in the map. It will only contain the features from each layer selected on the map. This can then be queried.
$currentMapExtentExtentThe current map extent. This value is not available for all scripts.
$currentToolTextThe type of tool selected. Will be one of new, add, effects, reshape, subtract, pan, select, unprotect. This value is not available for all scripts. It also represents the current state, not the state for why the script is running.
$drawingShapePolygonThe current drawing shape being digitised on the map. Not available for all scripts.
$drawingShapeLastPointPointThe last vertex added to the drawing Shape being digitised on the map. Not available for all scripts.
$typeofEditOperation 1Text The type of operation that just caused the feedback script to run. Will be one of new, add, newrelated, attributes, delete, effects, merge, split, reshape or subtract
$unchangedMap 1FeatureSetCollectionThe list of layers in the web map with data as it was originally before the current editing operation began executing. This is not available for all situations where scripting is run.
$editedFeatures 1FeatureSetThe set of features that have just been edited. This works with the FeatureSetByName or FeatureSetById function, to get access to a per layer set of features. This will not contain deleted features, as they are no longer in the map.
$originalEditedFeatures 1FeatureSet The set of features that have just been edited (in their original form). This works with the FeatureSetByName or FeatureSetById function, to get access to a per layer set of features. This will contain deleted features.

1: Will only be available if this is a post edit message

Return types

null | Text

ValueDescription
nullNo message to show
‘message’Text to show in the message.

Example

Show message when records with a certain status are edited:

/** Provide a message post edit if a certain field value is present.
 */

// get the edited features in the map layer.
var editedFeatsMLayer = MapLayer($editedFeatures, "Building Site");

// filter for any which matched a certain criteria.
var records = filter(editedFeatsMLayer, "STATUS=1");

// If there are edited features found with the above condition show a message.
if (count(records) > 0) {
  // Show the following message
  return "You must seal the record now you have closed it";
} else {
  // Do not show a message
  return null;
}