Field Clear Map

The Field Clear Map removes data from a specified field by setting its value to null during work item migration. It includes intelligent validation to ensure the field can be safely cleared without causing migration errors.

Last updated: September 10, 2025 | Edit this page | Discuss this page
top

Overview

The Field Clear Map is designed to safely remove data from specific fields during work item migration by setting the target field value to null. This field map includes comprehensive validation logic to prevent errors when clearing fields that have restrictions or requirements.

Clears a target field by setting its value to null, useful for removing data from specific fields during migration.

top

How It Works

The Field Clear Map follows a careful validation process before clearing any field:

  1. Field Existence Check: Verifies that the target field exists on the work item
  2. Allowed Values Validation: For fields with restricted values, ensures clearing is permitted
  3. Editability Check: Confirms the field is editable in the current context
  4. Required Field Check: Prevents clearing fields that are required
  5. Safe Clearing: Sets the field value to null only if all validations pass
top

Use Cases

This field map is commonly used for:

  • Data Sanitization: Removing confidential or sensitive information during migration
  • Legacy Field Cleanup: Clearing obsolete fields that are no longer needed
  • Process Compliance: Removing values that don’t comply with target system validation rules
  • Field Reset: Starting with clean slate for fields that will be populated differently
  • Privacy Requirements: Removing personally identifiable information (PII)
  • Validation Error Prevention: Clearing fields that cause validation errors in target system
top

Configuration Structure

Parameter
Type
Required
Description
Default Value
Parameter:
ApplyTo
Type:
List
Required:
false
Description:
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.
Default:
missing XML code comments
Parameter:
Enabled
Type:
Boolean
Required:
false
Description:
If set to true then the Fieldmap will run. Set to false and the processor will not run.
Default:
missing XML code comments
Parameter:
targetField
Type:
String
Required:
false
Description:
Gets or sets the name of the target field to be cleared/set to null during work item migration.
Default:
missing XML code comments
top

Sample

{
  "MigrationTools": {
    "Version": "16.0",
    "CommonTools": {
      "FieldMappingTool": {
        "FieldMaps": [
          {
            "FieldMapType": "FieldClearMap",
            "ApplyTo": [
              "SomeWorkItemType"
            ],
            "targetField": "Custom.FieldC"
          }
        ]
      }
    }
  }
}
top

Defaults

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

Basic Examples

top

Clearing Custom Fields

{
  "FieldMapType": "FieldClearMap",
  "ApplyTo": ["Bug", "Task"],
  "targetField": "Custom.LegacyField"
}
top

Removing Confidential Information

{
  "FieldMapType": "FieldClearMap",
  "ApplyTo": ["*"],
  "targetField": "Custom.InternalNotes"
}
top

Clearing Calculated Fields

{
  "FieldMapType": "FieldClearMap",
  "ApplyTo": ["User Story"],
  "targetField": "Microsoft.VSTS.Scheduling.Effort"
}
top

Validation Logic

The Field Clear Map includes robust validation to prevent migration errors:

top

Field Existence Validation

  • Checks if the target field exists on the work item type
  • Logs debug message and skips if field doesn’t exist
  • Prevents runtime errors during migration
top

Allowed Values Validation

  • For fields with restricted value lists, verifies that null/empty is allowed
  • Checks the AllowedValues collection of the field
  • Ensures clearing won’t violate field constraints
top

Editability Validation

  • Confirms the field is editable in the current work item state
  • Some fields become read-only in certain states or conditions
  • Prevents attempts to modify non-editable fields
top

Required Field Protection

  • Identifies required fields and prevents clearing them
  • Required fields must have values, so clearing would cause validation errors
  • Maintains data integrity during migration
top

Field Types and Considerations

top

String Fields

  • Most string fields can be safely cleared
  • Consider impact on reports and queries that depend on field values
top

Numeric Fields

  • Clearing numeric fields sets them to null (not zero)
  • Some calculations may be affected by null values
top

Date Fields

  • Clearing date fields removes the date entirely
  • Consider impact on workflows that depend on date values
top

Choice Fields

  • Fields with allowed values may not permit null values
  • Validation logic handles these cases automatically
top

System Fields

  • Be cautious when clearing system fields
  • Some system fields are required or calculated automatically
top

Best Practices

top

Strategic Field Selection

  • Only clear fields that truly need to be removed
  • Consider the impact on historical data and reporting
  • Test with a subset of work items first
top

Work Item Type Targeting

  • Use ApplyTo to target specific work item types
  • Different work item types may have different field requirements
  • Avoid blanket clearing across all work item types
top

Validation Awareness

  • Understand which fields are required in your target process
  • Check for custom validation rules that might be affected
  • Review field dependencies and calculated field impacts
top

Documentation

  • Document which fields are being cleared and why
  • Maintain records for audit and compliance purposes
  • Consider creating a rollback plan if needed
top

Error Prevention

The field map includes several safety mechanisms:

top

Graceful Handling

  • Logs informational messages when fields cannot be cleared
  • Continues processing other field maps without failing
  • Provides clear debugging information
top

Validation Messages

  • Field doesn’t exist: Logged as debug message, processing continues
  • Field not editable: Logged as debug message, processing continues
  • Field is required: Logged as debug message, processing continues
  • Allowed values restriction: Logged as debug message, processing continues
top

Safe Execution

  • Never throws exceptions that would halt migration
  • Always validates before attempting to clear
  • Maintains data integrity throughout the process
top

Performance Considerations

  • Field Clear Maps are highly performant
  • Validation checks are lightweight
  • No complex data processing required
  • Minimal impact on migration speed
top

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.fieldclearmap.json",
  "title": "FieldClearMap",
  "description": "Clears a target field by setting its value to null, useful for removing data from specific fields during migration.",
  "type": "object",
  "properties": {
    "ApplyTo": {
      "description": "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.",
      "type": "array"
    },
    "Enabled": {
      "description": "If set to `true` then the Fieldmap will run. Set to `false` and the processor will not run.",
      "type": "boolean"
    },
    "targetField": {
      "description": "Gets or sets the name of the target field to be cleared/set to null during work item migration.",
      "type": "string"
    }
  }
}
Documentation