Forums

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

Adding values to a cascading list from custom fields using a Post-Function

Robert Kendrick September 3, 2020

I'm looking for a way to have our users add Parent & Child values to a cascading list, for our closed service desk portal.  Scriptrunner is installed on our Jira, but I'm very new to scripting.  I know that there is a built-in script that would allow me to add to the cascading list, but we are looking to add to the list at the time the request is created and not have to be done by an Admin/admin page.  

My Fields 

Cascading list: "Network Programs" (this is the custom field I want to add to) 

Custom field 1: "Series Name" (reporter will fill this out, and will be added to the Parent side of the cascading list)

Custom field 2: "Episode Name" (this would be added as the child to the Series name)

Custom field 3: "Episode Name 2" (this would be added as the child to the series name)

 

I've searched this forum but I haven't seen anything works for our use case, especially since we need to allow our users to fill out more than 1 episode name field at the time they create the ticket.  

Thank you

2 answers

0 votes
Nic Brough -Adaptavist-
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 4, 2020

Ok, I understand now.

You will want to use the createOption function in the OptionsManager  class.  Unfortunately, I don't know exactly how to do that for cascading selects, and I can't find a decent example. 

I think that you create "Parent" options (such as your "series name") as though the field is a single-select, then for the child options, you have to create option objects  that name the parent as well as define the child option.

Robert Kendrick September 10, 2020

Okay, I'll give that a try and see if I can figure it out. 

Thanks for your help, i'll report back if it works. 

Like Nic Brough -Adaptavist- likes this
Abrar Ali
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 13, 2023

Hi @Robert Kendrick ,

Did you find a way to do this ?

-Abrar

0 votes
Iago Docando
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 3, 2020

A regular cascading field consists of just one "Parent" and one "child". If you need anything other than this (namely more than one level of children or more than one child selected) I believe you'll have to try some plugin/app.

Take a look at https://marketplace.atlassian.com/apps/5008/multi-level-cascading-select?hosting=datacenter&tab=overview or others like that one.

Once you have this sorted out you can take a look at the automation part.

Robert Kendrick September 3, 2020

Sorry, I think there may be a misunderstanding.  I’m not looking for more then 1 child list, I need to add multiple child values to the same parent 

ie

series name  

       Episode 1

       Episode 2 

 

series name will be added to the parent side of the list, while all episodes names would be the children of the series name. 

Nic Brough -Adaptavist-
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 3, 2020

Cascading selects are single value, you can't do "Parent / [several children]", the value can only be "Parent / Single selected child"

Robert Kendrick September 3, 2020

I know when I select from the drop-down that they are Parent/Single Selected Child, but I'm looking to use a post-function tot ADD values to the drop-down. 

Use case: 

Person A comes to my portal and selections New Network Series add

They fill out the form:

Custom field 1: "Series Name" (will be added to the Parent side of the cascading list)

Custom field 2: "Episode Name" (this would be added as the child to the Series name Parent)

Custom field 3: "Episode Name 2" (this would be added as the child to the SAME series name parent)

 

Now my team will be able to the newly entered Series Name & Episode names on our to create the airing IDs.   We Select the series name & episode name from the "Network Programs" list that was just edited.  

Nic Brough -Adaptavist-
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 3, 2020

So you do not want "to add multiple child values to the same parent", you want to automate the addition of new options to the selection lists?

Robert Kendrick September 3, 2020

yes, exactly   

Iago Docando
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 3, 2020

And does it necesarily have to be done through a postfunction? or could you use something like this plugin? https://marketplace.atlassian.com/apps/1212096/customfield-editor-for-jira?hosting=server&tab=overview

Robert Kendrick September 10, 2020

At this time, we are not looking to take on any more plugins, as we already have automation for jira & script runner installed. The goal/hope is that we can do as much of what we need to do with these plugins.  

 

I will take a look at the plugin you suggested and see if it is something that we should consider in the future.  

Iago Docando
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 10, 2020

You can definetely do A LOT of things with "just" those two :) 

I hope you can make it work. Try to contact the scriptrunner team and they might point you in the right direction.

Suggest an answer

Log in or Sign up to answer