Copy value from Security Level to Component

We have a couple of queues where the Security Level and Component are identical and we when at ticket is transferred to those queues both need to be set. Short story is people aren't doing that properly, so I want to be able to have the Security Level value set the Component (having only one component selected) and have not gotten it to successfully replace the value that it was. I was trying to figure out some groovy script to do it, but am so far unable to get anything working.

Does anyone have any pointers on how I could accomplish this?

1 answer

0 vote

Your groovy will need to convert from a security level to a component (obviously, using the name).  What have you got so far?

 

Sorry, it looks as if I wasn't clear enough. I don't have any background in scripting groovy before, and haven't found any information on how to script for this, but here is what I have: ComponentManager componentManager = ComponentManager.getInstance() componentManager.getProjectComponentManager().findByComponentName(project.getId(), issue.get("security")) issue.setComponents([component.getGenericValue()])

Ok, that's a start. What you need to do is work out a match on the name of the security level on to the component. Both security level and component are distinct object types, so you need to get the names out and do a lookup, so something like: def securitylevel = componentManager.getProjectComponentManager().findByComponentName(project.getId(), issue.get("security").getName() ) def component = componentManager.getProjectComponentManager().findByComponentName(project.getId(),securitylevel) issue.setComponentObjects([component])

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published Thursday in Jira

Meet the AUG leaders of Northern Virginia

@Rachel Wright (Jira Genie), @Billy Poggi (AUG NOVA, DC), and @Dana Jansen (Confluence Queen) are just some of the folks that lead one of the world's most active Atlassian User Group (AUG)....

158 views 5 9
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