Hello everybody.
I have created a script to find the value of the epic link field and add it to a new field. The script does not give me an error but it appends the object value of the "epic link" field in the new field
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.project.Project
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def checkLink = {link -> false}
def cFieldLinkEpica = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Link'}
def cFieldEpicaAux = customFieldManager.getCustomFieldObject('customfield_13501')
issue.setCustomFieldValue(cFieldEpicaAux, cFieldLinkEpica)
The script I need is the following:
1. Let him check the type of problem.
2. Let him get the value of the "Epic Link" field for that problem.
3. If it is a subtask, find the value in the parent task of that subtask.
3. Add the value of the "epic link" field to the newly created field.
Thanks in advance
David
It's the line
def cFieldValueLinkEpica = issue.getCustomFieldValue(cFieldLinkEpica).toString()
throwing
com.atlassian.jira.issue.fields.ImmutableCustomField cannot be cast to java.lang.String
Epic Link fields do not contain strings. You'll need to read the API Docs to find out how to get what you want out of it.
Hello,
I have made this new script in which it no longer gives me the error, but it does not load the internal value of the epic link field in the new field ...
Please can someone help me ... thank you.
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.properties.APKeys
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.link.IssueLink
import com.atlassian.jira.issue.link.IssueLinkManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.project.Project
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def checkLink = {link -> false}
def cFieldLinkEpica = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Link'}
def cFieldEpicaAux = customFieldManager.getCustomFieldObject('customfield_13501')
issue.setCustomFieldValue(cFieldEpicaAux, cFieldLinkEpica)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This is because your "Aux Epic field" is not an Epic Link type field and you are now trying to put an Epic Link into it. I suspect the content is actually an issue from https://library.adaptavist.com/entity/update-the-epic-link-for-an-issue-in-jira, so you'll probably need to extract something from the Epic you're trying to link to - summary, key, epic name etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.