Please help me to write condition

Alex
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.
June 20, 2022

Should work "Fast-track transition an issue" if conditions
1) not role Developers
2) The transition occurs only from a transaction (Waiting For Customer Reply)

my code:

import com.atlassian.jira.component.ComponentAccessor

!isUserMemberOfRole('Developers')

def workflow = ComponentAccessor.getWorkflowManager().getWorkflow(issue)

def wfd = workflow.getDescriptor()

def actionName = wfd.getAction(transientVars["actionId"]).getName()

// id transit/ (751)

if (actionName == "Waiting For Customer Reply"){

     return true

}

 фцыва (1).png

1 answer

1 vote
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 25, 2022

Try it like this:

import com.atlassian.jira.component.ComponentAccessor

def isDeveloper = isUserMemberOfRole('Developers')
if(isDeveloper) return false //stop the condition check immediately

def
workflow = ComponentAccessor.workflowManager.getWorkflow(issue)
def actionName = workflow.descriptor.getAction(transientVars["actionId"]).name

// id transit/ (751)
actionName == "Waiting For Customer Reply" //no need for if block, just return the result of this comparison

Suggest an answer

Log in or Sign up to answer