How to add a Behaviour on a transition Screen for a particular transition ?

Hi @Jamie Echlin [Adaptavist] ,

                                                Is it possible to write behaviour for a workflow transition ?

Use Case :

On a transition 'In Progress' 

  1. When a select list (single select) custom field 'Category' has a value "Engineering" then the In Progress Transition Screen should display only Build Date and Release Date custom fields.

  2. When a select list (single select) custom field 'Category' has a value other than 'Engineering' then the In Progress Transition Screen should display only Forecast Date and Committed Date custom fields.

Is this possible ? I know that workflow Validator does not work as it can only do Regular Expression Check, but we would like fields on Transition screen to be changed based on a custom field value change.

 

Thank you

Chander

2 answers

Seems like there are multiple questions here, but in a behaviour you can get the current FieldScreen using getFieldScreen(), so eg:

if (getFieldScreen().name == "Some Screen Name) {
 ...

or you can get the action name with getActionName()

Hey Jamie,

                  How do I add a condition to display only certain fields on transition screen.

This is the behavior i am writing on a select list field Category

 

def cField = getFieldById(getFieldChanged())
def cccField = getFieldByName("Committed CRO Complete")
def facField= getFieldByName("Forecast/Actual CRO complete")
def clField = getFieldByName("Committed Launch")
def falField = getFieldByName("Forecast/Actual Launch")
def selectedOption = cField.getValue() as String
if ((selectedOption == "Capability"))
{
 // clField and falField should be hidden on Tranistion Screen name "P3 Transition"

  clField.setHidden(true)
  falField.setHidden(true)
   
 }

Hi - I answered your question. What is unclear?

My question is,Will behaviors work on Transition screens ? Did i miss documentation on https://scriptrunner.adaptavist.com/4.3.1/jira/behaviours-overview.html ?

 

Please check my code. Am i doing anything wrong ?

 

script-snapshot.PNG

 

Please advise for any modifications in code above.

 

Regards

Chander

0 votes
Joseph Pitt Community Champion Jun 07, 2016

It may be easier to have a condition that allows or denies the transition based on the field value. You would then have two transitions and two transition screens. However, I presume Category and 'A' are the same field. If not what happens if they select Engineering for Category and something else for 'A'? I've done this type of things lots of times.

Sorry Joe, That was mistyped earlier, Category and A were same.

However, I am looking for only single Transition In Progress (Action ID : 21) and a single Transition Screen (In Progress Transition screen)

The workflow is like, Any status can be transitioned to In Progress status on same transition (re use of a transition)

 

Is there a way to do this either by writing behaviour or a groovy script ? I am using Script Runner plugin.

 

Regards

Chander Inguva

 

 

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 14, 2019 in Jira

Updates to jira.atlassian.com give you visibility into what's coming in Jira Server and Data Center

Hello, Community! My name is Gosia and I'm a Product Manager on Jira Server and Data Center here at Atlassian. Since 2002 when we launched our public issue tracker, jira.atlass...

584 views 1 15
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you