Hello everyone,
I am really stuck here with problem of setting a value to compoments. Description of what I am doing and what I would like to get.
1. We have some EPIC links which have set components, labels etc.
2. When we create Issue which is linked to some epic we would like to have a newly created Issue with same information in components. Instead of chosing it manually.
so what we did, was we created a post function which looks like this:
import com.atlassian.jira.component.ComponentAccessor;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.Issue;
import groovy.transform.Field;
import org.apache.log4j.Logger;
import org.apache.log4j.Level;
def log = Logger.getLogger("com.acme.CreateSubtask");
log.setLevel(Level.DEBUG);
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link');
Issue epic = (Issue)issue.getCustomFieldValue(epicLink);
if(epic)
{
issue.setComponent(epic.getComponents());
}
after debugging everything, it works. "log.debug issue.getComponents();" will show that all components was set by "issue.setComponent(epic.getComponents());" but on the site of issue. Value in field "component/s" is "none"
Can you please help me with this? I tried "issue.stored" or sth to update it, but nothing worked.