Transition IDs - Is it ok for two different JIRA workflows to have the same transition ID in them?

Trevor Hunt
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.
May 19, 2014

This is actually just a question of general curiosity.

I noticed there's potential for transitions in separate workflows to have the same ID and wanted to be sure this wouldn't cause any conflicts... specifically as it relates to Script Runner scripts (fast tracking).

This could easily happen if you build a workflow in a dev environment and migrate it to production.

If this can cause problems, what's a general solution/workaround?

2 answers

1 accepted

1 vote
Answer accepted
JamieA
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.
May 20, 2014

Yeah it's fine... the ID used in a param to a SR function will refer to the ID of an action in the current workflow, unless otherwise made clear.

Trevor Hunt
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.
May 20, 2014

Thanks again for the clarification!

0 votes
slothstronaut January 19, 2017

There might be an issue with Behaviour's Conditions and transition IDs:

 

I have two different Behaviours - mapped to all projects and all IssueTypes - for defining when comments are mandatory by transition IDs:

 

def commentField = getFieldById("comment")
log.debug("BEHAVIOUR 1 IS ACTIVE")
commentField.setHelpText("Please leave a comment (BEHAVIOUR 1)")
def commentField = getFieldById("comment")
log.debug("BEHAVIOUR 2 IS ACTIVE")
commentField.setHelpText("Please leave a comment (BEHAVIOUR 2)")

 

Both are assigned to "Field: Comment" and have Conditions for which transition they should get triggered for two different guide workflows (options: Required, Writable and Shown).

 

Lets say for Workflow 1, which is assigned to Behaviour 1 it should be triggered for transition IDs 1-10. Conditions:

  • For action: Set to IN_PROGRESS (1)
  • For action: Set to IN_PROGRESS (2)
  • For action: Set to IN_PROGRESS (3)
  • For action: Set to IN_PROGRESS (4)
  • For action: Set to IN_PROGRESS (...)
  • For action: Set to IN_PROGRESS (10)

Workflow 1 additionally has a transition Set to REOPENED (31) which is not mentioned in Behaviour1

For workflow 2, assigned to Behaviour 2, Conditions are the transition IDs 30-40

  • For action: Set to RESOLVED (30)
  • For action: Set to RESOLVED (31) 
  • For action: Set to RESOLVED (32) 
  • For action: Set to RESOLVED (33) 
  • For action: Set to RESOLVED (...)
  • For action: Set to RESOLVED (40)

 

Now if I transition an Issue in workflow 1 and the transition ID is e.g. 31 (in range of workflow 2) i get the following logs:

BEHAVIOUR 1 IS ACTIVE //I think that is the ID check
BEHAVIOUR 2 IS ACTIVE //I dont know why this should be triggered in guideworkflow1

and the comment field is set mandatory with helptext "Please leave a comment (BEHAVIOUR 2)"

 

even if transition ID 31 for workflow 1 is "Set to REOPENED" (differently named)

and transition ID 31 for workflow 2 is "Set to RESOLVED" (!= Set to IN_PROGRESS)

 

I think the behaviour gets triggered by the matching transition ID, even if the guide workflow is a different one, and the transition names are different.

 

 

Is this an reproducible issue or am I missing sth in my instance here?

 

ScriptRunner 4.3.12


Greetings to @Adaptavist =) 

Suggest an answer

Log in or Sign up to answer