Field Value To Tag Map
The Field Value To Tag Map adds a tag to the target work item when a source field’s value matches a regular expression, formatted the way you choose.
Overview
The Field Value To Tag Map turns a source field’s value into a tag on the target work item, but only when the value matches a pattern. Use it to keep a meaning that the target process has no field for, such as a Blocked flag, as a tag you can query.
missing XML code comments
How It Works
For each work item it applies to:
- If the source work item does not have
sourceField, or its value is null, nothing happens. An empty string is not skipped. - If
patternis set, the value must match it as a regular expression. Ifpatternis empty, any non-null value matches, including an empty string: withformatExpressionset toBlocked, an empty field still adds theBlockedtag. Use a pattern such as.+to skip empty values. - The tag is
formatExpressionwith the value in place of{0}. IfformatExpressionis empty, the tag is the value itself. - The tag is added to the target work item’s existing tags. Duplicate tags are removed, and the tags are only written if they changed.
In configuration, set FieldMapType to FieldValueToTagMap.
Use Cases
- Flags: tag work items whose
Microsoft.VSTS.CMMI.BlockedisYes. - Selected states or categories: tag only the values you care about, for example
Status: ActiveandStatus: Resolved.
Configuration Structure
topOptions
topSample
{
"MigrationTools": {
"Version": "16.0",
"CommonTools": {
"FieldMappingTool": {
"FieldMaps": [
{
"FieldMapType": "FieldValueToTagMap",
"ApplyTo": [
"SomeWorkItemType"
],
"sourceField": "Microsoft.VSTS.CMMI.Blocked",
"pattern": "Yes",
"formatExpression": "{0}"
}
]
}
}
}
}Defaults
{
"MigrationTools": {
"Version": "16.0",
"CommonTools": {
"FieldMappingTool": {
"FieldMaps": [
{
"FieldMapType": "FieldValueToTagMap",
"ApplyTo": [
"*"
]
}
]
}
}
}
}Basic Examples
topTag blocked work items
{
"FieldMapType": "FieldValueToTagMap",
"ApplyTo": ["*"],
"sourceField": "Microsoft.VSTS.CMMI.Blocked",
"pattern": "Yes",
"formatExpression": "Blocked"
}
Tag selected values with a prefix
{
"FieldMapType": "FieldValueToTagMap",
"ApplyTo": ["Bug"],
"sourceField": "System.State",
"pattern": "(Active|Resolved)",
"formatExpression": "Status: {0}"
}
Good Practices
- Anchor the pattern (
^Yes$) when a partial match would tag too much: the pattern matches anywhere in the value, and the match is case-sensitive. - To tag every value of a field, use the Field To Tag Field Map instead.
Troubleshooting
- No tag appears: check that the field reference name in
sourceFieldis the source’s, that the work item type is inApplyTo, and that the value matchespattern.
Schema
This is the JSON schema that defines the structure and validation rules for this configuration.
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://devopsmigration.io/schema/schema.fieldmaps.fieldvaluetotagmap.json",
"title": "FieldValuetoTagMap",
"description": "missing XML code comments",
"type": "object",
"properties": {
"ApplyTo": {
"description": "A list of Work Item Types that this Field Map will apply to. Use \"*\" to apply it to all Work Item Types. A field map with an empty list applies to no Work Item Types and never runs.",
"type": [
"array",
"null"
],
"items": {
"type": "string"
}
},
"Enabled": {
"description": "Not used: every configured field map runs for the work item types in `ApplyTo`. To turn a field map off, remove it from `FieldMaps`.",
"type": "boolean"
},
"formatExpression": {
"description": "missing XML code comments",
"type": [
"string",
"null"
]
},
"pattern": {
"description": "missing XML code comments",
"type": [
"string",
"null"
]
},
"sourceField": {
"description": "missing XML code comments",
"type": [
"string",
"null"
]
}
}
}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