Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,363,464
Community Members
 
Community Events
168
Community Groups

How to clean single select field(convert from text field) value?

I used the Behaviours function to simulate the secondary interactive drop-down menu

import com.atlassian.jira.component.ComponentAccessor;
def dutyCode = getFieldById(getFieldChanged())
def rootCauseCode = getFieldByName("Root Cause Code")
def dutyCodeValue = dutyCode.value as String
def queryValue = dutyCodeValue.split(' ')[0] as String

//convert text field to single select field
rootCauseCode.convertToSingleSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/getRootCauseCodeByDutyCode?query=" + queryValue,
query: false,
formatResponse: "general"
]
])

//clean rootCauseCode value when options updated
rootCauseCode.setFormValue('') //this line don't work

How should I do?  thanks!

 

1 answer

0 votes

Hi @lizong wei 

What about move the clear value line before converting the text field? 

//clean rootCauseCode value when options updated
rootCauseCode.setFormValue("")

//convert text field to single select field
rootCauseCode.convertToSingleSelect([
ajaxOptions: [
url : getBaseUrl() + "/rest/scriptrunner/latest/custom/getRootCauseCodeByDutyCode?query=" + queryValue,
query: false,
formatResponse: "general"
]
]) 

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events