Hi there,
I have a manager who wants to have a transition on epics for the purpose of creating a set of stories.
I can create his list of issues and set various custom fields for him in a pastfunction, but nothing I do sets the Epic link.
I have tried by issue ID and key, and also tried using a text custom field I created to hold the issue key value.
Logger.getLogger("com.onresolve.scriptrunner").setLevel(Level.DEBUG Issue issue = issue def id=sourceIssue.key // Get the Epic Link field CustomField epicLink = customFieldManager.getCustomFieldObjectByName('Epic Link') // Create the issue issue.summary = 'Create tenant for ' + sourceIssue.key checkAttachment = {attachment -> false} issue.assignee = null issue.setCustomFieldValue(epicLink,id)
I also can't seem to import any greenhopper methods nor call the epicLinkManagerImpl as a bean.
Is there any way to do this in JIRA 7.1 with the latest ScriptRunner, or would it help in any way to upgrade Jira? Maybe I could sacrifice a goat or something?
Thanks in advance for all your help!
If I remember correctly, you should store issue object for epic link field. Like:
issue.setCustomFieldValue(epicLink,sourceIssue)
Why doesn't this work for me?
(is the issue type wrong?)
I get
2017-03-10 11:31:56,640 WARN [common.UserScriptEndpoint]: Script console script failed: groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.DocumentIssueImpl.setCustomFieldValue() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl, null) values: [PMOA-40, null] Possible solutions: getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField) at Script1636$_run_closure1.doCall(Script1636.groovy:42) at Script1636.run(Script1636.groovy:28)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yup, just test checkLink = {link -> false} in the subtasks, and that fixed it up just fine.
Thanks again for the save
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
And clear the epic link. Thus:
checkLink = {link -> false}
issue.setCustomFieldValue(epic,
null)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Help!
Why am I getting (with the code above)
Error
No signature of method: com.atlassian.jira.issue.DocumentIssueImpl.setCustomFieldValue() is applicable for argument types: (com.atlassian.jira.issue.fields.ImmutableCustomField, null) values: [Epic Link, null] Possible solutions: getCustomFieldValue(com.atlassian.jira.issue.fields.CustomField)
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.
You need the MutableIssue interface. If you use this method from a ScriptRunner workflow function, the issue is already of type MutableIssue. If you write your own groovy script, you have to use com.atlassian.jira.issue.MutableIssue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I think this all depends on exactly where you run the statements.
I am using them as a condition with the built-in post function to create a sub-task.Works fine.
It looks like other folks in the thread may be trying these lines in the console or perhaps a custom script, so of course this will behave differently, as the imports and variable declarations in the built-in script will not be present in the console.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Holy cow IT WORKS!!!!
Alexey, you are awesome
The only bad thing that happened is that on the Training issue type, which creates a set of subtasks on creation, it copied the Epic link to those.
Do you think I could get rid of that with checkLink = {link -> false}, or is that fallout from that recent bug I think I recall seeing?
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 different from usual issue links, you should set value of this field to null in cloned issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ah, I see what you mean. I bet this only seemed to work because of the subtask issue type.
For safety, I've also added:
//Kill the little b*tard def epic = customFieldManager.getCustomFieldObjects(issue).find {it.name == 'Epic Link'} issue.setCustomFieldValue(epic, null)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.