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!
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/
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.ComponentAccessorimport com.atlassian.jira.issue.Issueimport com.atlassian.jira.issue.ModifiedValueimport com.atlassian.jira.issue.util.DefaultIssueChangeHolder
def issueKeyToAssociate = "GOXFUNC-8734" // Epic Key to associate with
def issueManager = ComponentAccessor.issueManagerdef customFieldManager = ComponentAccessor.customFieldManager
def issue = event.issue as Issue // Assuming 'event' is provided by Jira Listener
// Get the predefined epic issuedef epicIssue = issueManager.getIssueByCurrentKey(issueKeyToAssociate)
if (epicIssue) {// Get the Epic Link custom fielddef epicLinkField = customFieldManager.getCustomFieldObjects(issue).find { it.name == 'Epic Link' }
if (epicLinkField) {// Check if the issue being created is of the desired issue typeif (issue.issueType.name == "SNOW-Bug") { // Replace "SNOW-Bug" with your actual issue type// Update the Epic Link custom fieldepicLinkField.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.")}
Hi Perisic,
We don't have Automation plugin hence we can not use this.
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.
Is there any other way?
It looks like you're new here. Sign in or register to get started.