It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

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

chander inguva Jun 07, 2016

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

1 vote
JamieA Jun 07, 2016

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()

chander inguva Jun 08, 2016

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)
   
 }
JamieA Jun 08, 2016

Hi - I answered your question. What is unclear?

chander inguva Jun 08, 2016

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 Leader 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.

chander inguva Jun 07, 2016

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
This widget could not be displayed.
This widget could not be displayed.
Community showcase
Published in Next-gen

Introducing subtasks for breaking down work in next-gen projects

Teams break work down in order to help simplify complex tasks. This is often done iteratively, with tasks being broken down into smaller tasks and so on until the work is accurately captured in well-...

3,996 views 20 22
Read article

Community Events

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

Find an event

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

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you