Snippets

Matthew Clark (Adaptavist) Behaviour Field Level Only Script - Access Target Project on Clone screen created by Clone Plus plugin with scriptrunner behaviours

Created by Matthew Clark last modified
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.jira.groovy.user.FieldBehaviours
import org.apache.log4j.Logger
import org.apache.log4j.Level
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours
def log = Logger.getLogger(getClass())
log.setLevel(Level.DEBUG)

String projectIdOnScreen = getFormContents().get("pid")
log.debug("Target Project ID = ${projectIdOnScreen}")

if(projectIdOnScreen.isNumber()) {

    def projectObj = ComponentAccessor.getProjectManager().getProjectObj(projectIdOnScreen as Integer)
    log.debug("Target Project Object = ${projectObj?.key}")
}

Comments (0)