Hello,
I have the following script which will fill the different texts in the description field according to the options in the custom field "Request Type". The problem is that the text in the description does not change when I change the option in the custom field. I have to click the button Create (the ticket wasn't created cause the mandatory fields are empty)/or refresh the page to have the effect.
Could you please indicate how I could have the text changed immediately when the custom field changed the value?
Thank you in advance for your help.
Here is the script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.customfields.manager.OptionsManager
import com.atlassian.jira.issue.customfields.option.Options
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.CustomFieldManager
def desc = getFieldById("description")
def selectList = getFieldByName("Request Type")
FormField Requesttype = getFieldByName("Request Type")
def stringValue = Typededemande.getValue() as String
log.error("stringValue:" + stringValue)
if (stringValue == "Access Request")
{
def defaultValue = """- Name :
- Date :
""".replaceAll(/ /, '')
desc.setFormValue(defaultValue)
}
if(stringValue == "Creation plan" || stringValue == "Creation folder"|| stringValue == "Modification Structure"|| stringValue == "Close space")
{
def defaultText = """- Name :
- Date:
- Types :
- Theme :
""".replaceAll(/ /, '')
if (! underlyingIssue?.description) {
desc.setFormValue(defaultText)
}}