Forums

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

Is it possible to display the custom field values based on other two custom field values ?

Maheshbatta
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!
September 2, 2019

For example, I have custom filed A with values 1,2,3 

                                custom field B with values 4,5,6 

                                custom filed c with values x,y,z, !,@,#. 11,13,15

If I select custom filed value A as 1 and custom field value of B as 4 then custom field C should display following values x,y,z

I'm using script runner plugin, with following behavior, but no luck

import groovy.transform.BaseScript
import com.atlassian.jira.issue.customfields.option.Option
import com.onresolve.jira.groovy.user.FormField
import com.atlassian.jira.component.ComponentAccessor
def A=getFieldByName("A")
def B=getFieldByName("B")
def C=getFieldByName("C")

if(A.getValue() == "1" && B.getValue().equals("4")
{

C.setFormValue(optionFor(C, "x", "y", "z").optionId)

}

else if(A.getValue() == "2" && B.getValue().equals("5")
{
C.setFormValue(optionFor(C, "!", "@", "#").optionId)
}

 

1 answer

0 votes
Fazila Ashraf
Community Champion
September 2, 2019

@Maheshbatta  , Shouldnt you be using formField.setFieldOptions(Iterable) instead of setFormValue on C?

Maheshbatta
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!
September 2, 2019

@Fazila Ashraf , Thanks for your reply, tried it but no luck

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events