You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Log.LogWarning("FieldCalculationMap: Target field '{TargetField}' does not exist on work item {WorkItemId}. Skipping calculation.",Config.targetField,target.Id);
64
+
return;
65
+
}
66
+
67
+
// Validate that all source fields exist and collect their values
Log.LogWarning("FieldCalculationMap: Source field '{SourceField}' does not exist on work item {WorkItemId}. Skipping calculation.",parameter.Value,source.Id);
Log.LogWarning("FieldCalculationMap: Source field '{SourceField}' is null on work item {WorkItemId}. Skipping calculation.",parameter.Value,source.Id);
Log.LogWarning("FieldCalculationMap: Source field '{SourceField}' with value '{FieldValue}' is not numeric on work item {WorkItemId}. Skipping calculation.",parameter.Value,fieldValue,source.Id);
88
+
return;
89
+
}
90
+
91
+
parameterValues[parameter.Key]=numericValue;
92
+
}
93
+
94
+
// Evaluate the expression
95
+
varexpression=newExpression(Config.expression);
96
+
97
+
// Set parameters
98
+
foreach(varparaminparameterValues)
99
+
{
100
+
expression.Parameters[param.Key]=param.Value;
101
+
}
102
+
103
+
// Evaluate and get result
104
+
varresult=expression.Evaluate();
105
+
106
+
if(expression.HasErrors())
107
+
{
108
+
Log.LogError("FieldCalculationMap: Expression evaluation failed with error: {Error} for work item {WorkItemId}",expression.Error,source.Id);
109
+
return;
110
+
}
111
+
112
+
// Convert result to appropriate numeric type and set target field
Log.LogDebug("FieldCalculationMap: Successfully calculated and set field '{TargetField}' to '{Result}' for work item {WorkItemId}",Config.targetField,convertedResult,target.Id);
117
+
}
118
+
else
119
+
{
120
+
Log.LogWarning("FieldCalculationMap: Could not convert calculation result '{Result}' to target field type for work item {WorkItemId}",result,target.Id);
121
+
}
122
+
}
123
+
catch(Exceptionex)
124
+
{
125
+
Log.LogError(ex,"FieldCalculationMap: Unexpected error during calculation for work item {WorkItemId}",target.Id);
126
+
}
127
+
}
128
+
129
+
/// <summary>
130
+
/// Attempts to convert a field value to a numeric type.
131
+
/// </summary>
132
+
/// <param name="value">The field value to convert</param>
0 commit comments