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
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.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It would be easier to set a scripted validator rather than a behaviour.
Looking at the example titled
And trying to adapt it to issue.fixVersions might be a good starting point.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you very much for help, Ignacio.
Issue is resolved.
This worked fine: ! ( issue.affectedVersion*.name.contains("Backlog")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Awesome! I just pointed to the solution, but you achieved it! Congrats! :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
:)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.