Copy Value from cascading list to custom field


I am trying to copy first value of cascade select list to a custom text field "Business" and second value to security level.

I was earlier using below groovy on create issue post function to copy first value of cascade list to security level.

import org.apache.log4j.Category
import com.opensymphony.user.User
import com.googlecode.jsu.util.WorkflowUtils
import com.atlassian.jira.ManagerFactory
import com.atlassian.jira.ComponentManager
import org.ofbiz.core.entity.GenericValue

def log = Category.getInstance("com.onresolve.jira.groovy.MriskCondition")

ComponentManager componentManager = ComponentManager.getInstance()
IssueSecurityLevelManager securityLevelManager = componentManager.getComponentInstanceOfType(

IssueSecuritySchemeManager issueSecuritySchemeManager = ManagerFactory.getIssueSecuritySchemeManager()
IssueSecurityLevelManager issueSecurityLevelManager = ManagerFactory.getIssueSecurityLevelManager()

GenericValue srcProjectGV = issue.getProject()
def issueSecurityScheme = issueSecuritySchemeManager.getSchemes(srcProjectGV).size() == 0 ? null : issueSecuritySchemeManager.getSchemes(srcProjectGV)[0]

User currentUser = componentManager.getJiraAuthenticationContext().getUser()

def sourceFieldName = "customfield_10572"

def sourceFieldVal = WorkflowUtils.getFieldValueFromIssue(issue, WorkflowUtils.getFieldFromKey(sourceFieldName))
sourceFieldVal = sourceFieldVal.getKeysAndValues()

if ( sourceFieldVal != null ) {
def business = sourceFieldVal[null][0]
log.debug("business: '$business'" )
def secLevelGvList = issueSecurityLevelManager.getUsersSecurityLevels(issue.getGenericValue(), currentUser)
def secLevelGv = secLevelGvList.find ({ it.get("name") == "$business"})

if (secLevelGv) {
log.debug ("Set ${issue.getKey()} to $business")
issue.setSecurityLevel (secLevelGv)


Now I want to copy first value to a text custom field and secend value to security level.

Could you please modify above script to solve my problem ?

1 answer

This widget could not be displayed.

Any Help ??

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Aug 22, 2018 in Marketplace Apps

How a Marketplace app tech team is achieving gender diversity

Hello! My name is Genevieve Blanch, and I'm the Marketing Manager at RefinedWiki, creators of apps to give teams the tools to customize Atlassian platforms. Currently, 44% of the tech team at Re...

421 views 3 17
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you