JIRA Workflow transition properties?

Arjun Jadhav August 20, 2018

Hi,

I have set JIRA workflow transition properties (i.e key and value pair)  and i want to access these properties in script runner listeners(Groovy script) but i am not able to do this. I am new in groovy script.

can anyone please help me in this, thanks in advance.

 

Arjun

 

2 answers

1 accepted

2 votes
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 21, 2018

Hello @Arjun Jadhav

You can do it via worflowManager like this

import com.atlassian.jira.component.ComponentAccessor

def workflowManager = ComponentAccessor.getWorkflowManager()
def workFlow = workflowManager.getWorkflow("workflow name")
def action = workFlow.getAllActions().find {it.name == "transition name"}
def properties = action.getMetaAttributes()
log.error("Attributes: ${properties.toString()}")
nallu November 29, 2018

Hi @Mark Markov, Is it possible to set the workflow property through script listener?

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 5, 2018

Hi @nallu

I think something like this:

import com.atlassian.jira.component.ComponentAccessor

Map attributes = new HashMap()
attributes.put("attribute","value")
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def workFlowManager = ComponentAccessor.getWorkflowManager()
def workflow = workFlowManager.getWorkflow("Some workflow")
def status = ComponentAccessor.getConstantsManager().getStatus("Some status name")
def stepDescriptor = workflow.getLinkedStep(status)
stepDescriptor.setMetaAttributes(attributes)
workFlowManager.updateWorkflow(user, workflow)

but i don't tested

Like Deleted user likes this
0 votes
Arjun Jadhav August 22, 2018

It's working..

Thanks Mark

Suggest an answer

Log in or Sign up to answer