Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Automation: How to reference a newly created issue key in an email

Dimitrios Papadopoulos
May 25, 2022

Dear all , 

i have created an automation where upon creation, i am assiging the ticket to me, change a field and put a comment.

Then i am triggering an email and i am trying to get the ticket number in the subject or the email body. 

However , i am not able to get the result i wish for.

Here is my workflow : 

2022-05-25_16h06_13.png

I have read following threads : 

https://community.atlassian.com/t5/Jira-Software-questions/Jira-Automation-How-to-reference-a-newly-created-issue-key-in-an/qaq-p/1537181

https://community.atlassian.com/t5/Jira-Software-questions/Jira-Automation-Send-an-email-with-key-of-issue-created/qaq-p/1347484

But i could apply the solutions.

Thanks,

Dimitris

1 answer

1 vote
Abraham - New Verve Consulting
Contributor
November 26, 2019

Hi Nathan,

I still have the same question and the only thing I could find that would return all-to-all transitions (on top of normal regular transitions) is IssueWorkflowManager (https://docs.atlassian.com/software/jira/docs/api/8.4.3/com/atlassian/jira/workflow/IssueWorkflowManager.html).

If you use this code in the ScriptRunner script console (server), you can test it yourself:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.workflow.IssueWorkflowManager

def issueWFMngr = ComponentAccessor.getComponentOfType(IssueWorkflowManager.class)
def currentIssue = ComponentAccessor.issueManager.getIssueByCurrentKey("KS-1") // your issue key here instead of KS-1
def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def trueAvailableActions = issueWFMngr.getAvailableActions(currentIssue, currentUser)

return "Available actions/transitions: ${trueAvailableActions.collect {it.name + ': '+ it.id}}"

 

Suggest an answer

Log in or Sign up to answer