Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Copy value from Security Level to Component

Jacob Jaskolka February 16, 2015

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 votes
Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 16, 2015

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

 

Jacob Jaskolka February 16, 2015

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()])

Nic Brough -Adaptavist-
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 16, 2015

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