Different "Create Issue" behavior

Frank Winkler August 22, 2018

Hi,

I considered, that there are two different behaviors when creating a new Jira issue:

  1. In most cases after clicking "Create" a dialog is displayed that allows to select project and issue type and to enter other the issue data.
  2. In some other cases (for example if "Create" is not simply clicked but opened in a new tab) first a small dialog allows the selection of project and type and after a click on "Next" the issue data can be entered in a second dialog.

Normally that would make no difference but we use Behaviours from Aptavist SriptRunner to set description templates depending on the issue type. In the first case this works great, in second case the behaviour doesn't work - probably because in this case there is no field "issuetype" to watch for changes.

Is there a way to avoid the second "Create" behavior (so Jira must always use the dialog with project and issue type fields)? Or is it possible to initialize the description field in the second dialog depending on selected project and type?

Thanks in advance!

Frank

1 answer

1 accepted

1 vote
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 22, 2018

Hello @Frank Winkler


I ve worked around with this defect and find solution.

Place your script in Initialiser function and it will work.

Frank Winkler August 22, 2018

Hi@Mark Markov!

I placed the script in Initialiser AND to field "Issue Type" and now it works in both dialogs. 

Thx, best regards!

Frank

Frank Winkler September 3, 2018

Hi @Mark Markov

Unfortunately I have to come back to this problem because I considered that using the Initialiser function works fine for the 2. "Create Issue" variant but not for the 1.

Our Description templates must be set only if field Desription is empty or contains exactly one of the given templates. If the user changes the Issue type field after he entered someting into the Description field or changed the displayed template than the Description must no be replaced by a template. For this reason I use

def desc = getFieldById('description')
def currDescr = desc.getValue()

to decide if the content of Description field may be replaced by one of the templates or not. Using this code in the Initialiser, currDescr is always NULL so the Description will always be replaced with one of the templates.

The main problem seems to be, that the Initialiser script runs not only when the Create Issue screen is opened - it runs, too, when the field Issue type is changed in the open Create Issue screen.

So, the solution could be to have a script that runs after field "Issue type" was changed and an Initialiser Script, but ensure that the Initialiser only changes the Description field when it runs in the second "Create Issue" variant.

So, my question: is there a way to detect in the Initialiser script in which of the two "Create Issue" variants it currently runs? Maybe this can done by detecting if "Issue type" is displayed as a DropDown menu or as read only value? Unfortunately com.onresolve.jira.groovy.user.FormField has no isEditable() method.

Thx!

Frank

Julius Bär August 21, 2020

@Frank Winkler  were you able to solve this? We face the exact same problem. Would appreciate if you could share your fix.

Dennis January 22, 2021

@Frank Winkler I was just struggling with a similar Problem where we wanted to set the project and issue type descriptions as field descriptions when creating an issue. This does not reliably work in the two step Create screen, so we now check for the contents of the priority field. Usually, this should always have a value, but in the first step of the create screen, it will be null. So we have something like this to just skip the remaining script, if we are in the first step:

if (getFieldById("priority").value == null) {
return
}

Hope this helps if you have not already solved it!

Suggest an answer

Log in or Sign up to answer