Generate report IDs

Many workflows require that a unique identifier be generated when a feature or record is created so it can be referenced and tracked in other workflows. The Generate IDs tool can be used to configure custom unique identifiers that will be applied to features at a regularly scheduled interval of your choosing. Note that the tool only generates the configuration; an additional script (provided) must be run to actually update the features with incrementing identifier values.

Configuring and executing this script requires the ArcGIS API for Python (Installed with ArcGIS Pro).

To configure the generation of IDs for features, complete the following steps:

  1. Download and extract the ServiceFunctions toolbox. The tools in this toolbox create and update a configuration file that can then serve as input for a scheduled script.
  2. Open the toolbox in ArcGIS Pro 2.x and, if you've never used the toolbox before, run the Define Connection Settings tool to establish a connection between the toolbox and the ArcGIS Enterprise portal or ArcGIS Online organization containing the layers for which you want to generate IDs.
  3. Open the Generate IDs tool.
  4. If the tool has not been run previously, start by specifying at least one identifier sequence in the General Identifier Settings section of the tool by providing the following values:
    • Sequence Name—Assign a name to the sequence. This value will appear in the drop-down menu for selecting the sequence to assign to each layer.
    • Pattern—The pattern to use for the sequence. This can be a combination of letters, number, and symbols. Mark the location for the incrementing value with a pair of curly braces {}. Python formatting will be applied to the pattern text, so string formatting syntax such as {0:03d} will pad the incrementing number section with zeros to a length of 3. For example, the pattern seq-{0:05d} would result in identifier values such as 'seq-0001', 'seq-002', 'seq-0010', etc.
    • Next Value—When initially creating the sequence, this should be the first value you'd like to use in the identifiers. After this point, this value will show the value to be used for the next identifier generated.
    • Interval—The interval by which the identifier values should increase between features. For example, an initial Next Value of 1 and an Interval of 10 would create identifiers with the incrementing values of 1, 11, 21, etc.
    Keep in mind that deleting or changing these sequences will impact all the layers that are configured to use the edited sequences.
  5. Choose the feature layer for which you'd like to generate identifiers by either choosing a layer from the active map, or by browsing to your hosted content and choosing a feature layer.
  6. If an identifier configuration already exists for the selected layer, a checkbox will appear that, when checked, will delete the existing identifier configuration for the selected layer. Alternatively, edit the identifier configuration and run the tool to overwrite the existing identifier configuration for the selected layer.
  7. Choose the sequence to use to generate the identifiers for each feature in the layer.
  8. Choose a text field to store the generated identifier.
  9. Run the tool to write out the identifier configuration for the layer and any changes to the identifier sequences. To run the updates on the layer, execute the script.
  10. To configure identifiers for another layer, re-run the tool with the settings for the next layer. Keep in mind that the General Identifier Settings are not specific to any one layer - they apply to all layers configured using this tool.
  11. To test the configuration, run the script that accompanies the toolbox. If errors occur, they will be written to a log file that will be created in the same directory as the script. The ServiceFunctions toolbox, script, and the servicefunctions.json file created by the toolbox must all remain in the same directory.

Set up Task Scheduler

Use Windows Task Scheduler to schedule the script to regularly scan the configured layers and generate IDs for new features.

This is only necessary if has not been previously scheduled. All the tools in this toolbox share a common configuration file and execution script so only one scheduled task is required to automate running all the associated processes.

  1. Open the Task Scheduler on the computer that is hosting the scripts.
  2. Click Action > Create Task and name your task.
  3. Click the Action tab and click New.
  4. Set Action to Start a Program.
  5. Browse to the location of your Python 3 installation (for example, <default directory>\C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe).
  6. In the Add arguments text box, type the name of the script (
  7. In the Start in text box, type the path to the folder where your script is and click OK.
  8. Click the Trigger tab, click New, and set a schedule for your task.
  9. Click OK. When the trigger occurs, the scripts will begin scanning the configured layers and, for each one, processing (in order) configurations for generating identifiers, enriching reports, moderating reports, and sending emails.