in packages/webhook-triggers-app/src/workflows/workflow-field-changes.js [139:187]
value: String(newValue || '')
};
}
} catch {
// Silently skip if not supported
}
return null;
}
/**
* Collects all changed fields from an issue using YouTrack API
* @param {Object} issue - The issue object
* @returns {Array<Object>} Array of changed fields with name, oldValue, and value
*/
function collectChangedFields(issue) {
const changedFields = [];
// Check built-in properties (summary, description) first
const builtInProperties = ['summary', 'description'];
for (let i = 0; i < builtInProperties.length; i++) {
const propName = builtInProperties[i];
const change = checkBuiltInPropertyChange(issue, propName);
if (change) {
changedFields.push(change);
}
}
// Check custom fields
if (!issue.fields) {
return changedFields;
}
// Get all field names, filtering out methods
const allKeys = Object.keys(issue.fields);
const fieldNames = allKeys.filter(function (key) {
const value = issue.fields[key];
return typeof value !== 'function';
});
// Check each field for changes using YouTrack API
for (let i = 0; i < fieldNames.length; i++) {
const fieldName = fieldNames[i];
const currentValue = issue.fields[fieldName];
try {
// YouTrack API: issue.fields.isChanged(fieldName) where fieldName is a STRING
let fieldWasChanged = false;
if (typeof issue.fields.isChanged === 'function') {