1
0
-1

スクリーン設定で適用してる複数のフィールドを

transition毎のValidatorsで表示するフィールドを一つのスクリーン設定で制御したい


例>

スクリーン設定 hogehoge

設定フィールド

担当者

参照者

解決状況


transition AAAA

のときにスクリーン設定 hogehogeで表示するフィールド

担当者

参照者


transition BBBB

のときにスクリーン設定 hogehogeで表示するフィールド

担当者

解決状況


の様に制御したいです


スクリーン設定の数をできるだけ減らしたいので

上記のような処理が可能なのか知りたいです

    Commentコメントを追加...

    3 回答

    1.  
      2
      1
      0

      樋口晃 さんがおっしゃる通り、
      アドオンを使用して非表示にすることになるかと思います。

      また強引に JavaScript で非表示にすることもできなくはないかと思いました...
      動作につきましては確認が必要です...

      <script>
      (function() {
        JIRA.bind(JIRA.Events.NEW_CONTENT_ADDED, function(e, context, reason){
          if (reason === JIRA.CONTENT_ADDED_REASON.dialogReady) {
            var projectKey = getProjectKey(),
                transitionName = fixString(getTransitionName());
            
            if (projectKey && transitionName) {
              switch (projectKey) {
                case 'CON':
                  switch (transitionName) {
                    case '完了へ':
                      getField('duedate');
                      break;
                    case '進行中へ':
                      getField('assignee-single-select', 'customfield_13101', 'priority-single-select');
                      break;
                  }
              }
            }
          }
        });
        
        // 前後の空白を除く
        function fixString(text) {
          return text ? text.replace(/^\s*|\s*$/, '') : null;
        }
        
        function hideField(targetField) {
          targetField.parentElement.style.display = 'none';
        }
        
        // 即時に取得できないフィールドがあるのでタイミングをずらす
        function getField() {
          var args = arguments;
          setTimeout(function() {
            if (args.length) {
              for (var i = 0, len = args.length; i < len; i++) {
                var targetField = document.getElementById(args[i]);
                if (targetField) {
                  hideField(targetField);
                }
              }
            }
          }, 0);
        }
        
        function getProjectKey() {
          return (JIRA && JIRA.API && JIRA.API.Projects && JIRA.API.Projects.getCurrentProjectKey)
                ? JIRA.API.Projects.getCurrentProjectKey()
                : null;
        }
        
        function getTransitionName() {
          return document.getElementById('issue-workflow-transition-submit')
                ? document.getElementById('issue-workflow-transition-submit').value
                : null;
        }
      })();
      </script>


      ただし、解決状況をは必須項目になってしまうかと思いますので、
      ScriptRunner で非表示にしても JavaScript で非表示にしても
      エラーとなりトランジションを実行できないですね...

        Commentコメントを追加...
      1.  
        1
        0
        -1

        やはりそうですよね・・・

        ご回答ありがとうございました

          Commentコメントを追加...
        1.  
          1
          0
          -1

          JIRA 標準ではこの機能は無いので、実装するとしたら Script Runner の Behavior などを使って実装する事になると思います。

            Commentコメントを追加...