Error while creating an issue

Vyshnavi Reddy March 26, 2018

Invalid value '14930' passed for customfield 'Linked Fix Version List'. Allowed values are: , -1

I have created two custom fields the Second field values are displayed  depending on the First custom field. Two fields are of type SelectList. while creating the issue I was getting the above error. 

 

please help me out.

Thanks in advance

1 answer

0 votes
Vasiliy Zverev
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.
March 26, 2018

Perhaps you should have a look at cascade custom field.

Vyshnavi Reddy March 27, 2018

Hi Vasiliy Zverev, could you please explain me how to create and use this cascade custom field.

Vyshnavi Reddy March 27, 2018

I'm getting the values of the second custom field programatically  using behaviours and after that the create screen is giving the error.

 

my behavioural code is as follows:

import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.version.Version;
def selver = getFieldByName("Linked Fix Version List");
def project = getFieldByName("Linked Project List").getValue() as Project;

   Collection<Version> versions = new ArrayList<Version>()
   if(project){
       for(Version version :project.getVersions()){
        if(version.isReleased()){
         continue
        }else{
         versions.add(version)
        }
       }
import com.atlassian.jira.project.Project;
import com.atlassian.jira.project.version.Version;
def selver = getFieldByName("Linked Fix Version List");
def project = getFieldByName("Linked Project List").getValue() as Project;

   Collection<Version> versions = new ArrayList<Version>()
   if(project){
       for(Version version :project.getVersions()){
        if(version.isReleased()){
         continue
        }else{
         versions.add(version)
        }
       }
   }
  selver.setFieldOptions(versions)

Vasiliy Zverev
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.
March 28, 2018

Custom fields are create into admin section.

Here is discussed how ti se value for CascadeField: https://community.atlassian.com/t5/Jira-questions/Groovy-Set-Cascading-Field-Value/qaq-p/241484

What namely do you want to store into cascade field and why do you need versions?

Vyshnavi Reddy April 3, 2018

Hi Vasiliy,

I created a cascading custom field named projectList. I set the values for the parent options i.e project names and I need to get the options for the parent (versions) dynamically using behaviour code. Please help me to sort this issue.

 Thanks in advance.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2018

It's because your code is trying to do the wrong thing.

A cascading select list in Jira is a field similar to select list, albeit a bit more complicated because of the option-pairs, but the data and options are roughly the same principle.

The value you set in a selection is an option, one drawn from a list of pre-defined options read from the database.

Your behaviour is amending the presented list, adding options to it.  It might appear to work on the front-end, but it's absolute nonsense to the field, because the values you are then trying to save do not exist as options for the field.  It will only work if your administrators add all your project and version pairs to the field, in which case you can drop your behaviour script because the field is going to have them already.

Vyshnavi Reddy April 22, 2018

Hi Nic,

 

I am still facing the same issue. Let me explain you my issue in detail. I created a custom field project picker and one more customfield of type select list and now i am trying to get the versionList using the above  behaviour code. Now the thing is I am able o get the versionList into the select list in front end but the selected version i not saved into db because of different option id's. can u please help me how to store those versions into db or any other alternative method to do this?

 

Thanks alot in advance,

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 23, 2018

The "selected id" is not being stored because your code is changing it to something that is wrong.  I can't tell you what is wrong with your code because it seems to be doing something that is nonsense.

Could you describe exactly what you are trying to do?

Vyshnavi Reddy April 24, 2018

yeah sure,

I will share some screen shots for better understanding.

1.Linked project list and linked fix version list are my custom fields. when I click on the create button I will be able to see the screenshot1.

2.In the next step if I select the project from LinkedProjectList then it will populate the corresponding versions of the selected project. This versions, are populated using behaviours script.

3.In screenshot behaviour u can see the code I used to get the versions to be popualated into Linked fixed version list.

4.After selecting the issue when I click on the create button then I am getting an error invalid value passed....

5.the Linked project List is of type project picker and Linked fixed version List is of type select list while creating this select list I added an option test version whereas all these things are shared in the screen shots 

Please help me to sort this issue.

screenshot1.pngscreenshot2.pngscreenshot3.pngscreenshotbehaviour.pngscreenshot4.pngscreenshot5.pngscreenshot6.pngscreenshot7.pngscreenshot8.png

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 24, 2018

Again, your code is fetching an arbitrary version number which is not a valid entry for the field.  That will not work, you cannot randomly add things to fields like that. 

Vyshnavi Reddy April 24, 2018

Can we have any api to insert the data into jira database. Is there any way to solve this or no use about thinking the solution. 

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 24, 2018

You can make separate REST calls to update Jira, including the ability to create versions (options in custom fields were not there last time I looked)

Vyshnavi Reddy April 27, 2018

Thank you so very much for the help Nic, I think I can't solve this..

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 27, 2018

There isn't really anything to "solve" - your code is trying to use functionality that simply is not there.

At this point, it would be better to revisit the requirement and see what you might use to do it.

In your original question, you pretty much described the behaviour of a cascading select.  Why are you not using one of them?  What is the user going to get if you were to implement something else?

Suggest an answer

Log in or Sign up to answer