Scriptted post function using groovy to swap the component value

Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 28, 2014

I am looking for a groovy script to swap the Component field value as a post-function. Ex: On clicking on an action, the component value must change from "A" to "B". The script I'd tried is given below,

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.util.ImportUtils
import com.atlassian.jira.component.ComponentAccessor
ComponentManager componentManager = ComponentManager.getInstance()
compList = ["A":"B" , "CAT":"DOG"]
if (compList[componentManager] != null)
{
issue.setComponents(compList[componentManager])
}

2 answers

0 votes
JamieA
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.
November 4, 2014

What's this supposed to do? compList[componentManager] I'm not going to write this for you. I don't mean this sarcastically, but do a few groovy tutorials.

0 votes
Vishnukumar Vasudevan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
November 3, 2014

@Jamie Echlin [Adaptavist] , Can you help us here ?

Suggest an answer

Log in or Sign up to answer