The action enabled profile is used to determine if an action button is enabled or disabled. It can also determine whether an action is shown at all.

Profile variables

Variable name Type Description
$map FeatureSetCollection The 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.
$userId Text The unique user ID of the editor who is logged into the application.
$userName Text The full name of the editor who is logged into the application.
$userIdentity Text Provides a credential instance. This can be used when accessing external layers with the FeatureLayer function. The credentials represent the user’s logged in credentials.
$session Dictionary A 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.
$selection FeatureSetCollection The 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.
$currentTool Text The 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.
$currentMapExtent Extent The current map extent. This value is not available for all scripts.

Return types

BooleanText

Value Description
true The action is enabled.
false The action is disabled.
‘hide’ The action is hidden.

Example

Hidden unless a feature is selected from a particular layer:

// Only show command if a feature is selected
if (count(FeatureSetByName($selection, "<LAYERNAME>")) > 0) {
  return true;
} else {
  return "hide";
}