Populating Text field value in Select list custom field on issue creation

Hello,

I have two custom field named as Epic-QC(Single line text field) and Detailed functionality list(Select list custom field).

I need to populate Epic-QC(Single line text field) to Detailed functionality list(Select list custom field).

So please can you help us on this.

Thanks.

 

5 answers

1 accepted

This widget could not be displayed.

You can do this with the following behaviours script attached to the "Epic-QC" field:

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

def epicField = getFieldById(getFieldChanged())

def detailedListField = getFieldByName("Detailed Functionality List")

def epicValue = epicField.getValue()

if (epicValue) {
    detailedListField.setFieldOptions([(epicValue): epicValue])
} else {
    detailedListField.setFieldOptions(["-1": "None"])
}

It will set whatever value is in the "Epic-QC" field into the "Detailed Functionality List" field. If no value is set the value in the list will be None.

Dear @Adam Markham [Adaptavist],

Thank you so much for your response.

I tried your above behaviours script and it is populating "Epic-QC" field value into "Detailed functionality list" but when i click on update i got the error .Please refer the below attachment for the same.

Also When "Epic-QC" field value get populate into "Detailed functionality list" then it should not remove the previous drop-down option values.

epic_qc_to_dfl.jpg

 

Thanks and Regards,

Suchit R Kharatmol.

Those numbers next to the values are the option ids, you need to match it with the corresponding one, So for suchit your code needs to be:

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
 
@BaseScript FieldBehaviours fieldBehaviours
 
def epicField = getFieldById(getFieldChanged())
 
def detailedListField = getFieldByName("Detailed Functionality List")
 
def epicValue = epicField.getValue()
 
if (epicValue) {
    detailedListField.setFieldOptions(["11400": epicValue])
} else {
    detailedListField.setFieldOptions(["-1": "None"])
}

I did not see error myself when testing this. Have you another behaviour enabled for this field or another validator?

Dear @Adam Markham [Adaptavist],

Thank you so much for your response.

I tried your above behaviours script and it is populating "Epic-QC" field value into "Detailed functionality list". Its working fine now without any errors.

Thanks a lot for your help Adam.

Thanks and Regards,

Suchit R Kharatmol

 

 

 

Great, glad you got it working. If you want the other options you need to specify them like so in the setFieldOptions call.

detailedListField.setFieldOptions(["11400": epicValue, "11313": "demo"])

Yes I tried the same and it is working fine  for all other options as well.

Thank you so much for your help.

This widget could not be displayed.

What have you tried so far?

This widget could not be displayed.

Hi @Jamie Echlin [Adaptavist],

Thank for your response.

I tried the below behavior script.

 

FormField epic=getFieldByName("Epic-QC");
String epic_value=epic.getValue();
log.error("----------- Epic-QC value is---"+epic_value)
FormField dfl=getFieldByName("Detailed Functionality List").setFormValue(epic_value);

Thanks and Regards,

Suchit R Kharatmol.

 

 

 

 

This widget could not be displayed.

Is this a single select list? Do you want to populate the list with values in "Epic-QC" or select one in the list based on "Epic-QC" value?

This widget could not be displayed.

Hi @Adam Markham [Adaptavist] ,

Thank for your response.

Yes Detailed functionality list is the single list select list custom field. I want  to populate "Epic-QC" value in the Detailed functionality list single list field .

Thanks and Regards,

Suchit R Kharatmol.

 

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in New to Jira

Are you planning to trial, or are currently trialling Jira Software? - We want to talk to you!

Hello! I'm Rayen, a product manager at Atlassian. My team and I are working hard to improve the trial experience for Jira Software Cloud. We are interested in   talking to 20 people planning t...

99 views 1 0
Join discussion

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you