The map feedback profile defines a dynamic set of features to show on the map. 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 1
Text
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 1FeatureSetThe 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 post edit map feedback.

Return types

null | FeatureSet

ValueDescription
nullNo features to show.
FeatureSetA set of features defined as a FeatureSet to show on the map.

Example

Footer message based on selection:

/** Create a message indicating the number of selected features.
 */

// find the selected features in a map layer.
var mLayerSelection = FeatureSetByName($Selection, "Site Cover");
// Sum some fields together
var n = sum(
  mLayerSelection,
  "PriceBandAUnits + PriceBandBUnits + PriceBandCUnits"
);
return "Total value selected : " + n;

Display point when clicked on the map:

// This script works in combination with pointer move feedback, a session variable pointerLocation and custom keyboard shortcut

var mapGraphics = [];

Push(mapGraphics, {
	geometry: $session.pointerLocation,
	symbol: `{
    "type": "esriSMS",
    "style": "esriSMSCircle",
    "color": [
        255,
        20,
        147,
        255
      ],
    "size": 12,
    "angle": 0,
    "xoffset": 0,
    "yoffset": 0,
    "outline": {
      "color": [
        255,
        255,
        255,
        255
      ],
      "width": 1
    }
  }`
});

// Return symbol at the cursor point.
return {
	graphics: mapGraphics
};

Pointer move feedback:

// This script works in combination with Feedback data script, a session variable pointerLocation and custom keyboard shortcut
// Purpose: On a keyboard shortcut, display a point at the pointer location. Store the pointer location in a session variable for further use

if ($event == "move") {
    return null;
}

if ($pointerPoint == null) {
    return {
        "action": "noop"
    };
}

// The actual map feedback data script can only listen and update if $session variable used.
// The $session variable cannot be updated from this script - the keyboard shortcut action will take the State variable and update the $session variable
State("pointerLocation", $pointerPoint);

return null;