When I attempt to replicate the behaviors script from this example, I can't seem to get a result from the getBehaviourContextId function.
/rest/com.onresolve.jira.plugin.Behaviours/1.0/behaviours/validators.json [com.acme.CreateSubtask] web item clicked:null
Here is the code I currently have:
import org.apache.log4j.Logger
import org.apache.log4j.Level
def log = Logger.getLogger("com.acme.CreateSubtask")
log.setLevel(Level.DEBUG)
import com.atlassian.jira.component.ComponentAccessor
def issueManager = ComponentAccessor.getIssueManager()
log.debug "web item clicked:" + getBehaviourContextId()
if (getBehaviourContextId() == "cr-doc-bug") {
getFieldById("project-field").setReadOnly(true)
getFieldById("issuetype-field").setReadOnly(true)
def contextIssue = issueManager.getIssueObject(getContextIssueId())
getFieldById("summary").setFormValue("Issue created from ${contextIssue.key}").setReadOnly(true)
getFieldById("issuelinks-linktype").setFormValue("relates to").setReadOnly(true)
getFieldById("issuelinks-issues").setFormValue(contextIssue.key).setReadOnly(true)
}
I did map the behavior to the target project, I think:

Any thoughts?