Heya,
I'm trying to do a nifty Epic Workflow which creates some tasks / stories on certain transitions. I want these Tasks to have Epic link the original issue they were cloned from. Note that they are cloned from the Epic itself, so they can't inherit the Epic Link of the issue they were cloned from since Epics don't have Epic Link.
I've tried a few things so far and this one I was expecting to work, any ideas why it isn't?
def cf = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Link'} issue.setCustomFieldValue(cf, sourceIssue.key)
Cheers,
Ovidiu.
I tried a very dirty & basic workaround which solved a problem for me in the past:
I'm getting this error when looking at the Epic after I do this, so setting the field Epic Link requires something specific which I don't know about. The issue Key is not good enough.
EDIT: This actually works, just be careful to set the Copy Field to Field post-function AFTER the issue is created.
"I'm getting this error when looking at the Epic after I do this" - Do you mean Task or Epic?
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.
"This will exit the Creation process and leave an inconsistency on issues. Make sure the "Creates the issue originally." Post Function is first in the Create transition."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Right, that was a bit embarrassing. Well I'm happy to say that with this dirty workaround (and having the "Copy link from "Dummy" to "Epic Link"" AFTER the issue was created) it works.
And it gracefully fails for other situations (such as when someone creates one manually).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
nice to hear, could you please accept or upvote my answer. thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see here - https://answers.atlassian.com/questions/211505
issue.setCustomField might not be right
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
the same thing here - https://answers.atlassian.com/questions/13418341 (answer by user Dima Pasko )
Also, make sure that you have "Epic Link" issue added on the "Screens" of the issueTypes which are being cloned.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Epic Link is added on the Screen, that's not the problem.
Even though the first ticket wasn't about a post-function, it had a snippet of code that might be what I was looking for. I tried it and it didn't work:
import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.util.DefaultIssueChangeHolder def tgtField = customFieldManager.getCustomFieldObjects(issue).find {it.name == "Epic Link"} def changeHolder = new DefaultIssueChangeHolder(); tgtField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(tgtField), sourceIssue.key),changeHolder);
My coding skills are really not that strong and I'm really out of my league right now. I really don't understand why issue.setcustomfield = sourceissue.key doesn't work.
Epic Link is a custom field and it's expecting an issue key, so it should work, no?
Any help is appreciated.
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.