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

Chander Inguva
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 7, 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
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 7, 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
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 8, 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
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 8, 2016

Hi - I answered your question. What is unclear?

Chander Inguva
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 8, 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
Joe Pitt
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 7, 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
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 7, 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