const entities = require('@jetbrains/youtrack-scripting-api/entities');

exports.rule = entities.Issue.onChange({
  title: 'Copy subsystem from parent task when issue is linked as a subtask',
  guard: (ctx) => {
    return 
  },
  action: (ctx) => {
    
    
    const issue = ctx.issue;

    const safeSetSubsystem = function (subtask) {
      if (subtask.project && !subtask.project.isArchived) {
        if (subtask.project.key === issue.project.key || subtask.project.findFieldByName(ctx.Subsystem.name)) {
          if (!subtask.fields.Subsystem) {
            const value = subtask.project.findFieldByName(ctx.Subsystem.name).findValueByName(issue.fields.Subsystem.name);
            if (value) {
              subtask.fields.Subsystem = value;
            }
          }
        }
      }
    };

    issue.links['parent for'].added.forEach(safeSetSubsystem);
  },
  requirements: {
    Subsystem: {
      type: entities.EnumField.fieldType
    },
    SubtaskOf: {
      type: entities.IssueLinkPrototype,
      name: 'Subtask',
      outward: 'parent for',
      inward: 'subtask of'
    }
  }
}); напиши условие срабатывания скрипта. Должен срабатывать если  задача становиться подзадачей для другой задачи