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.
Performs mathematical calculations on numeric fields using NCalc expressions during migration.
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
Options
topHow 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
.
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
.
Field Resolution Rules
- Each variable in the expression (e.g.
[effort]
) must be defined inparameters
. - 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.
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.
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.
Samples
topSample
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"
}
]
}
}
}
}
Defaults
Defaults
{
"MigrationTools": {
"Version": "16.0",
"CommonTools": {
"FieldMappingTool": {
"FieldMaps": [
{
"FieldMapType": "FieldCalculationMap",
"ApplyTo": [
"*"
]
}
]
}
}
}
}
Classic
Classic
{
"$type": "FieldCalculationMapOptions",
"expression": "[effort] * [rate]",
"parameters": {
"effort": "Custom.EstimatedHours",
"rate": "Custom.HourlyRate"
},
"targetField": "Custom.EstimatedCost",
"ApplyTo": [
"*",
"Bug",
"Task"
]
}
Metadata
In this article
Project Information
Azure DevOps Marketplace
Maintainer
Created and maintained by Martin Hinshelwood of nkdagility.com
Getting Support
Community Support
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