Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Error while creating an issue

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

Perhaps you should have a look at cascade custom field.

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

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)

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?

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.

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.

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,

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?

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

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. 

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. 

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)

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

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
TAGS
Community showcase
Posted in Jira Core

How to manage many similar workflows?

I have multiple projects that use variations of the same base workflow. The variations depend on the requirements of the project or issue type. The variations mostly come in the form of new statuses ...

3,953 views 11 5
Join discussion

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you