Reputation: 85
I need to set epic link using groovy if a condition is true. I'm using the following script:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue;
def customFieldManager = ComponentAccessor.getCustomFieldManager()
IssueManager issueManager = ComponentAccessor.getOSGiComponentInstanceOfType(IssueManager.class)
def epiclink = CustomFieldManager.getCustomFieldObject("customfield_1000")
issue.setCustomFieldValue(epiclink,"MAR-1518")
But im getting this error:
I tried this code from this question but it didn't worked for me.
Upvotes: 0
Views: 433
Reputation: 1560
You just have a typo. In line
def epiclink = CustomFieldManager.getCustomFieldObject("customfield_1000")
you are calling the CustomFieldManager
class (inital is uppercase)
However, you need to call your variable customFieldManager
which is from ComponentAccessor.customFieldManager
So, the above line should be:
def epiclink = customFieldManager.getCustomFieldObject("customfield_1000")
Upvotes: 1