Field Calculation Map

The Field Calculation Map is a specialised field map used in the Azure DevOps Migration Tools. It allows you to compute values dynamically during migration by applying mathematical or logical operations on numeric fields. Calculations are defined using NCalc expressions and can reference one or more source fields using named parameters.

This is especially useful for scenarios where derived values need to be migrated, such as calculating cost based on effort and rate, or generating summary fields that are not explicitly stored in the source system.

Last updated: June 25, 2025 | Edit this page | Discuss this page

Performs mathematical calculations on numeric fields using NCalc expressions during migration.

top

Purpose and Use Cases

This map is typically used when:

  • You want to calculate Custom.EstimatedCost as EstimatedHours × HourlyRate
  • You need to convert days to hours or apply rounding
  • You wish to assign weights to different numeric fields and store a computed score
  • Your source project uses different naming or units, and you want to normalise during migration
top

Options

Parameter Type Description Default Value
ApplyTo List A list of Work Item Types that this Field Map will apply to. If the list is empty it will apply to all Work Item Types. You can use “*” to apply to all Work Item Types. missing XML code comments
expression String Gets or sets the NCalc expression to evaluate. Variables in the expression should be enclosed in square brackets (e.g., “[x]*2”). Not specified
parameters Dictionary Gets or sets a dictionary mapping variable names used in the expression to source field reference names. {}
targetField String Gets or sets the target field reference name where the calculated result will be stored. Not specified
top

How NCalc Expressions Work

The NCalc engine supports:

  • Standard arithmetic: +, -, *, /
  • Logical operations: &&, ||, ==, !=
  • Functions: Pow(a, b), Min(a, b), Max(a, b), Abs(x), etc.
  • Conditional evaluation using if(condition, trueValue, falseValue)

Example Expression:

[effort] * [rate]

This multiplies the values of the two fields Custom.EstimatedHours and Custom.HourlyRate.

top

Behaviour and Execution

  • The field map executes during work item migration and before saving to the target.
  • It applies to the latest revision only unless otherwise configured.
  • The calculated value overwrites any existing value in targetField.
top

Field Resolution Rules

  • Each variable in the expression (e.g. [effort]) must be defined in parameters.
  • Values are pulled from the source work item using the mapped reference names.
  • If a referenced field is missing or null, the expression evaluation may fail.
  • Non-numeric fields will cause an evaluation error.
top

Practices

  • Use consistent naming conventions for parameters to avoid confusion.
  • Log intermediate values when troubleshooting expression evaluation.
  • Always test with a sample dataset using run-local before production use.
  • Use ApplyTo to limit the map to only relevant work item types.
top

Limitations

  • Only works with numeric source fields.
  • Errors during evaluation are not recoverable mid-run unless caught at validation.
  • Does not support cross-work-item calculations.
top

Samples

top

Sample

Sample

{
  "MigrationTools": {
    "Version": "16.0",
    "CommonTools": {
      "FieldMappingTool": {
        "FieldMaps": [
          {
            "ApplyTo": [
              "Bug",
              "Task"
            ],
            "expression": "[effort] * [rate]",
            "FieldMapType": "FieldCalculationMap",
            "parameters": {
              "effort": "Custom.EstimatedHours",
              "rate": "Custom.HourlyRate"
            },
            "targetField": "Custom.EstimatedCost"
          }
        ]
      }
    }
  }
}
top

Defaults

Defaults

{
  "MigrationTools": {
    "Version": "16.0",
    "CommonTools": {
      "FieldMappingTool": {
        "FieldMaps": [
          {
            "FieldMapType": "FieldCalculationMap",
            "ApplyTo": [
              "*"
            ]
          }
        ]
      }
    }
  }
}
top

Classic

Classic

{
  "$type": "FieldCalculationMapOptions",
  "expression": "[effort] * [rate]",
  "parameters": {
    "effort": "Custom.EstimatedHours",
    "rate": "Custom.HourlyRate"
  },
  "targetField": "Custom.EstimatedCost",
  "ApplyTo": [
    "*",
    "Bug",
    "Task"
  ]
}
top

Metadata

Project Information
Azure DevOps Marketplace
YouTube Channel
Maintainer

Created and maintained by Martin Hinshelwood of nkdagility.com

Documentation Versions
Production Azure DevOps Migration Tools Release Version
Preview Azure DevOps Migration Tools Preview Version
Getting Support
Community Support
Questions & Discussions

The first place to look for usage, configuration, and general help.

Commercial Support

We provide training, ad-hoc support, and full service migrations through our professional services.

Azure DevOps Migration Services
Documentation