Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Exclude “Backlog” value from list of values for Affected Version field only on create issue UI

helen levich
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 28, 2018

We are trying to do not to allow users to put "Backlog" value into "Affected Version" field during issues creation.  Though we want to have “Backlog” value available for Affected Version field, but not when issue is created.  Something, like blocks "Backlog" value the on the create transition or  to exclude “Backlog” value from under Affected Version only on create issue UI.
We would appreciate any suggestions/help with this.

Thank you

2 answers

1 accepted

0 votes
Answer accepted
Ignacio Pulgar
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 28, 2018

Assuming you need to be able to select any versions during issue creation, except for the "Backlog" version, that may only be achieved through ScriptRunner Behaviours or through the use of JavaScript to hide said value.

helen levich
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 29, 2018

Thank you, Ignacio.

We did not find any ScriptRunner scripts that would do something like that among examples.

We are hoping that maybe someone had similar issue and we can use their script as starting point.

Thank you

Ignacio Pulgar
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 29, 2018

It would be easier to set a scripted validator rather than a behaviour.

https://scriptrunner.adaptavist.com/4.3.4/jira/recipes/workflow/validators/simple-scripted-validators.html

Looking at the example titled 

Validating a multi-select option is selected

And trying to adapt it to issue.fixVersions might be a good starting point.

helen levich
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 30, 2018

Thank you very much, Ignacio. Great Suggestion

The only follow up question is where do you put validator? We only want to exclude "Backlog" value from list on issue create form. There is no create issue transition.

What would you do?

helen levich
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.
September 13, 2018

It is great suggestion Ignacio. I tried number of possible conditions for Simple scripted validator.

My condition is: if  "Backlog"  value in  affectedversion field on create issue, then give an error.

Here is my steps
On workflow --> open--> create transition

Add validator
Add Script Validator
Add Simple scripted validator

Looked for example of condition for "Multi select list constains value"
'My value' in cfValues['My Multi List']*.value

Changed to my situation: If Backlog is picked then give error
!('Backlog' in cfValues['affectedVersion']*.value)

This does not work. Does any one has any suggestion?

Tried below, which does not work either

! ( issue.affectedVersion*.name.contains("Backlog")
! (cfValues['affectedVersion']*.value.contains("Backlog")
cfValues['affectedVersion']?.value == 'Backlog'
cfValues['affectedVersion'].getValue() == 'Backlog'
cfValues['affectedVersion'] == 'Backlog'

 

Would appreciate help

Thank you

Ignacio Pulgar
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.
September 14, 2018

Can't test it until next Wednesday or so.

You've already made progress.

In order for you to get a quicker answer, you may ask a new question and tag it with appropriate labels like ie: ScriptRunner, Scripted-Validator, Validator, Script.

To improve your chances of getting a response, be as clear and concise as possible. Also, avoid using the word Backlog for referring to a version. Use a placeholder word which anyone recognises immediately as a version name, ie: '1.0'.

This is how I would ask that:

How to create this Scripted Validator?

What code line may I use to prevent transitioning an issue if '1.0' is one of its Fix Versions?

helen levich
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.
September 14, 2018

Thank you very much for help, Ignacio.

Issue is resolved.

This worked fine: ! ( issue.affectedVersion*.name.contains("Backlog")

Ignacio Pulgar
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.
September 14, 2018

Awesome! I just pointed to the solution, but you achieved it! Congrats! :)

0 votes
helen levich
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 30, 2018

:)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events