Uploaded image for project: 'Jira Server and Data Center'
  1. Jira Server and Data Center
  2. JRASERVER-12118

Set Component/Fix Version in post function does not set a component or version

    XMLWordPrintable

    Details

      Description

      SetComponentAndVersion.java
      public class SetComponentAndVersion implements FunctionProvider
      {
          /**
           * Automatically assign subtasks the same component/version as parent task.
           */
          public void execute (Map transientVars, Map args, PropertySet ps)
              throws WorkflowException
          {
              MutableIssue task = (MutableIssue)transientVars.get("issue");
              
              if (task.isSubTask())
              {
                  ComponentManager componentManager = ComponentManager.getInstance();
                  IssueManager issueManager = componentManager.getIssueManager();
                  MutableIssue parent = issueManager.getIssueObject(task.getParentId());
                  
                  task.setComponents(parent.getComponents());
                  task.setFixVersions(parent.getFixVersions());
                  task.store();
              }
          }
      }
      

      Fairly simple and straight forward. I have access to the components and versions from the parent task, but they are not set successfully on the child task.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              orapun A F
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: