Total scriptrunner noob!
I have two dropdown fields that I am attempting to tie together one the create/edit screens. The idea is to allow a user to pick an option in either field, and the other field will populate immediately with the appropriate value.
Fields:
If / Then:
My script so far is just an attempt to get something super simple to work. Once I have the basic recipe, I'll build it up from there.
import com.atlassian.jira.issue.IssueInputParameters
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
import com.atlassian.jira.component.ComponentAccessor
@BaseScript FieldBehaviours fieldBehaviours
def SWIDNumField = getFieldById(getFieldChanged())
String SWIDNumOption = SWIDNumField.getValue()
def SWIDNameField = getFieldByName("SWID Name")
if (SWIDNumOption == "111" )
{ SWIDNameField.setFormValue("one one one")
}
else if (SWIDNumOption == ("222") )
{ SWIDNameField.setFormValue("two two two")
}
else if (SWIDNumOption == ("333") )
{ SWIDNameField.setFormValue("three three three")
}
else
{
SWIDNameField.setFormValue("None")
}
Any help is greatly appreciated!
I have not found a good way of learning Groovy, besides attempting to solve problems like this. If there is a good course out there to logically learn how to groovy, I'm open learning and solving this on my own.
https://library.adaptavist.com/entity/set-form-field-values-from-issue-in-picker is quite close to what you want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.