How to set a field required via an Issue Collector although it is optional in JIRA ?

This question is in reference to Atlassian Documentation: Advanced use of the JIRA issue collector

For example I want to set the field description required when submitting an issue via a given Issue Collector.

The field description is optional in JIRA with no intention to set it required. How can I do?

Looking further into the Advanced use of the JIRA issue collector documentation, I also don't understand the usage of the fieldValues properties as a function. What does it do? Can I use this function to achieve my goal?

4 answers

1 accepted

This widget could not be displayed.

Eventually I ended up with my own Custom Issue Collector.

The goal is to mimic the behaviour of the native JIRA Issue Collector while offering more flexibility.
You click on a button to open a form, and you click on submit to create the issue.
Every Custom Issue Collector has its own label to stamp the issues created through it.

Form:
https://www.formget.com/how-to-create-pop-up-contact-form-using-javascript/

Submit using REST API:
https://api.jquery.com/jQuery.ajax/
https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis

Code in Confluence macro HTML:

$.ajax({
    type: "POST",
    url: "https://ourdomain/jira/rest/api/2/issue/",
    dataType: "json",
    contentType: "application/json",
    data: JSON.stringify(issue),
    async:false,
    xhrFields: {
      withCredentials: true
    },
    success: function (data, status, result) {
      console.log("ajax call succeeded", data, status, result);
      popup_message(data.key); //show new issue with clickable link and submit the form
    },
    error: function (result, status, error) {
      console.log("Internal Error ajax call", result, status, error);
      alert("Error:" +JSON.stringify(result) +"," +status +"," +error +".");
    },
  });

CONF URL = https://ourdomain/confluence.
JIRA URL = https://ourdomain/jira

This widget could not be displayed.

Basically there would be a simple solution if I could patch the HTML before showing the JIRA Issue Collector dialog.

Example with 3 fields Summary, Severity (a custom field), and Description of type string, list, and text.

The HTML on the page contains 3 elements:

<input class="text long-field" id="summary" name="summary" type="text" value="">


<select class="select" name="customfield_10159" id="customfield_10159">
    <option value="-1">None</option>
    <option value="10030">Critical</option>
    <option value="10031">Serious</option>
    <option value="10032">Non-critical</option>
</select>
 
<textarea class="textarea long-field wiki-textfield long-field mentionable" id="description" name="description" rows="12" wrap="virtual" data-projectkey="CMTOOLSPRCR" style="overflow-y: auto; height: 200px;"></textarea>

 

My need would be achieved if patching the HTML as follow:

<input class="text long-field" id="summary" name="summary" type="text" value="" required="">


<select class="select" name="customfield_10159" id="customfield_10159" required="">
    <option value="">None</option>
    <option value="10030">Critical</option>
    <option value="10031">Serious</option>
    <option value="10032">Non-critical</option>
</select>
 
<textarea class="textarea long-field wiki-textfield long-field mentionable" id="description" name="description" rows="12" wrap="virtual" data-projectkey="CMTOOLSPRCR" style="overflow-y: auto; height: 200px;" required=""></textarea>

Which consists in:

  1. Adding the attribute required="" on inside <input>, <select>, and <textarea>.
  2. Change the default value of the list from "-1" to "".

 

The thing is I don't know how to do this. Any clue?

This widget could not be displayed.

Another interesting solution would be to mimic the predefined JIRA Issue Collector named Got Feedback?.

Creating a new JIRA Issue Collector from the Issue Collector template named Got Feedback? produces a screen with any fields (not JIRA fields) all required.

At submit the values entered at the Issue Collector fields are grouped and inserted within the JIRA issue description.

How can we create such a similar custom JIRA Issue Collector?

  • With a form to collect the required information ie anything such as a radio field, a list field, a string field, a text field...
  • And the collected values stored within one or several JIRA issue fields at submit.
This widget could not be displayed.

Simple option to make a field mandatory if you don't want to hack: Jirassimo IntakeForms

Best, Vlad

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

141 views 16 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you