Uploaded image for project: 'Jira Software Data Center'
  1. Jira Software Data Center
  2. JSWSERVER-26125

The "Set Required Field" screen does not take into account mandatory fields from ScriptRunner behaviors

    • 4
    • 3
    • We collect Jira feedback from various sources, and we evaluate what we've collected when planning our product roadmap. To understand how this piece of feedback will be reviewed, see our Implementation of New Features Policy.

      Issue statement

      The "Set Required Field" screen does not honor/support the fields configured as mandatory via the behavior configuration from the 3rd party add-on ScriptRunner for Jira.

      Because of that, if a field is set as mandatory via ScriptRunner behaviors, this field will not show in the "Set Required Field" screen from Roadmaps plan, and the issue will fail to be created: nothing will happen when clicking on the Create button:

      For more information about this behavior, you can refer to the KB article below:
      https://confluence.atlassian.com/roadmaps-kb/advanced-roadmaps-for-jira-the-create-button-from-the-set-required-field-screen-does-not-work-1452670977.html

      Steps to replicate

      • Configure a field to be required using Jira's native field configuration feature
      • Configure another field to be required via the behavior configuration from ScriptRunner (for example, the Fix Version field as illustrated below)
      • Open a Roadmap Plan, create an issue from the plan, and click on Review changes
      • From the pop-up, click Save selected changes in Jira.
        • The "Set Required Fields" screen will open
      • Click on the Create button

      Expected behavior

      The mandatory field should show in the "Set Required Fields" screen, and the issue should be created after clicking the Create button

      Actual behavior

      The mandatory field is not showing in the "Set Required Fields" screen, and nothing happens after clicking the Create button

      Suggestion for the bug fix

      Ensure that the "Set Required Field" screen support the "Mandatory Field" configuration coming from ScriptRunner behaviors.

      Note

      This issue only occurs if there is:

      • at least 1 field set as required using Jira's native field configuration
      • at least 1 field set as required using ScriptRunner's behavior

      If there is no field set as required through Jira's field configuration, then it will be possible to create a Jira issue from a Plan, despite having 1 field set as required through ScriptRunner's behavior.

      Workaround

      Instead of using ScriptRunner behaviors to make the field mandatory, make it mandatory via Jira's native Field Configuration as illustrated below:






      Another possible workaround is adding a JS script through the announcement banner.
      It will display all fields when trying to create the issue from a roadmaps plan. That way, the field will be visible if one is made required through ScriptRunner.

      The script to be added to the banner is the following.

      <script type="module">
      document.addEventListener('DOMContentLoaded', function() {
      if (window.location.pathname.includes("/secure/PortfolioPlanView.jspa")) {
          const targetNode = document.body;
      
          const config = { childList: true, subtree: true };
      
          const callback = function(mutationsList, observer) {
              for (let mutation of mutationsList) {
                  if (mutation.type === 'childList') {
                      mutation.addedNodes.forEach(node => {
                          if (node.tagName === 'SECTION' && node.id === 'jpo-dialogs-jira-create-issue'){
                              const allFields = node.getElementsByClassName('qf-field');
                              Array.from(allFields).forEach(checkdiv => {
                                  checkdiv.style.display = 'block';
                              });
                          }
                      });
                  }
              }
          };
      
          const observer = new MutationObserver(callback);
      
          observer.observe(targetNode, config);
      }
      });
      </script>
      

          Form Name

            [JSWSERVER-26125] The "Set Required Field" screen does not take into account mandatory fields from ScriptRunner behaviors

            No work has yet been logged on this issue.

              Unassigned Unassigned
              jrey Julien Rey
              Votes:
              14 Vote for this issue
              Watchers:
              10 Start watching this issue

                Created:
                Updated: