Hello,
I have a problem with my Behaviour initialiser for the Constrained create issue Script Fragment. Even if I wrote all my code using if (getBehaviourContextId() == "link-create-LM") { , there is no change on my creating issue screen when i get to it using the button.
I read online that there were problems concerning Constrained create issue with behaviours, but I have Jira version 8.7.1 and ScriptRunner Version 6.2.1 so it should be okay. I also tried to place my button at different spots (operations-top-level and jira.issue.tools) and both don't work.
The weirdest thing is that it was working at the beginning, but I changed a little bit my script and nothing works anymore. I tried to write the original screen back and nothing works.
Do anyone know what could be the problem ?
Here's my behaviour initialiser code
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
def issueManager = ComponentAccessor.getIssueManager()
if (getBehaviourContextId() == "link-create-LM") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
def contextIssue = issueManager.getIssueObject(getContextIssueId())
def defaultValue = """PRJ créé à partir de : ${contextIssue.key}
En tant que
Je veux
Afin de """.replaceAll(/ /, '')
getFieldById("description").setFormValue(defaultValue)// Ajouter à la description et aux linked issues le lien vers l'Opportunité
getFieldById("issuelinks-linktype").setFormValue("relates to").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
getFieldById("customfield_13800").setFormValue(contextIssue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_13800"))).setReadOnly(true)
def typeDemande = getFieldById("customfield_13800").getFormValue()
if (typeDemande == "Demande client") {
getFieldById("customfield_14012").setFormValue(contextIssue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_14012")))
getFieldById("customfield_10606").setFormValue(contextIssue.getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10606")))
}
}