Hi Team,
I have issue type "A" and whenever this type of issue is created , Epic Link should be automatically added to it .
Please suggest some script .
Thank You!
Hi Preeti,
Are you saying create an Epic every time an issue is created with a certain issue type? Or link it to an existing Epic? And if an existing Epic, then how will it know which one?
Hi John,
Yes the existing one , we have as Epic which is already there , just whenever is issue type "Snow-Bug" is getting created it should be linked to the epic.
I have written some script - But It is not working when "Snow-Bug" is created automatically through mail handler.
It is getting linked to epic only when created manually.
Below is the script-
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def issueKeyToAssociate = "GOXFUNC-8734" // Epic Key to associate with
def issueManager = ComponentAccessor.issueManager
def customFieldManager = ComponentAccessor.customFieldManager
def issue = event.issue as Issue // Assuming 'event' is provided by Jira Listener
// Get the predefined epic issue
def epicIssue = issueManager.getIssueByCurrentKey(issueKeyToAssociate)
if (epicIssue) {
// Get the Epic Link custom field
def epicLinkField = customFieldManager.getCustomFieldObjects(issue).find { it.name == 'Epic Link' }
if (epicLinkField) {
// Check if the issue being created is of the desired issue type
if (issue.issueType.name == "SNOW-Bug") { // Replace "SNOW-Bug" with your actual issue type
// Update the Epic Link custom field
epicLinkField.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(epicLinkField), epicIssue), new DefaultIssueChangeHolder())
}
} else {
log.error("Epic Link custom field not found.")
}
} else {
log.error("Epic issue $issueKeyToAssociate not found.")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You don't need all of that. Just create an automation rule that is based on an Issue Created trigger.
Then add a Condition for Issue Type = Snow-bug
Then add an action for Edit Issue. Select the Parent field
Put in the value GOXFUNC-8734
Update the issue and you are good to go.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi John,
We don't have Automation plugin hence we can not use this.
Is there any other way?
Thank You!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Oh, are you in Server or Data Center? Also, there should be a free Lite version of Automation for Jira that you could use.
Do you have ScriptRunner or some other plugin for workflows?
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.
I guess that is what you were trying to do with above. :-) That's outside of my expertise, but you definitely should be able to accomplish it with the tool.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Preeti Yadav
You can use the automation rule for this.
Here is the example. For the Summary field, you can change this to be the one suiting your needs. More documentation on the smart values can be found here: https://support.atlassian.com/cloud-automation/docs/jira-smart-values-issues/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Perisic,
We don't have Automation plugin hence we can not use this.
Thank You!
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.