Hide one transition and show another transition based on custom field value entered

Anupam Sinha May 13, 2021

Hello Community, 

 

Please advise or help me. Its server instance of jira. I have scriptrunner  and JMWE plugins.  I am working on a workflow of a story. Workflow has Start, Status B, Status C, Status D, Status E and Completed. 

Problem : 

My story has a customfield : Test Analyst ( Single Line Text Field) and its in Status B in workflow transition.   If  Test Analyst field has been populated with analyst's name  then story's view screen should shows Status E transition button, mean to story will transition to Status E from Status B. 

If Test Analyst field has not been populated with analyst name then story view should show Status C transition button.   mean to story will transition to Status C from Status B.

 

Please advise me how to accomplish this task. 

Thank you so much. 

Regards,

Anupam

 

  

3 answers

2 accepted

0 votes
Answer accepted
Ravi Sagar _Sparxsys_
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 13, 2021

Hi @Anupam Sinha 

Are you on server or cloud. You can use Script Conditions to check for a specific field value. It can also be done with JMWE. I explained how to achieve this here, the example I used was to build an approval system and show transitions only when a condition is met.

You can do something similar on cloud as well but the main idea is to use Conditions.

I hope it helps.

Ravi

Anupam Sinha May 14, 2021

Thank You @Ravi Sagar _Sparxsys_ for helping me. It is nice and detail video. 

0 votes
Answer accepted
David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 13, 2021

Hi @Anupam Sinha 

with JMWE, you can use a Build-your-own Condition on both transitions (B to E and B to C). For transition to E, use this script:

issue.customfield_12345 != null

and for transition to C, use this script:

issue.customfield_12345 == null

Note that customfield_12345 needs to be replaced with the field ID of your "Test Analyst" custom field, which you can find on the "Issue Fields" help tab of the editor.

Anupam Sinha May 14, 2021

Thank You David for quick help. It is helpful. 

Madhura A S March 22, 2022

Hi @David Fischer ,

I am checking the value of Label and hiding/ displaying the transition. It works fine if Label field is not empty. But When Label is Empty It does not work.

for (label in issue.get("labels"))
if (label.getLabel()!="CX" )
{
return true
}
return false

 Transition 'x' will be hidden even if Label is empty. How to check for empty value in label

 

Thanks 

Madhura

David Fischer
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
March 22, 2022

Hi @Madhura A 

try this:

!issue.get("labels")?.any{it.label == "CX"}
Like Madhura A S likes this
Madhura A S March 22, 2022

Thanks! It worked

0 votes
Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 13, 2021

Hi @Anupam Sinha  You can do it easily with the help of Simple Scripted Condition which is a part of Script Runner and put this condition :- cfValues['Some Custom Field'] == 'Some Value'

As you have mentioned it's a single line text field, value is not constant in this case. Condition might fail sometime if Agent name is not correct or some spelling mistake while typing agent name in a field.

It's better to use User Picker if this field is for Analyst name or use Select List instead of Single line text field for Analyst name.


Thanks

Anupam Sinha May 14, 2021

Thanks @Vikrant Yadav  for help and a very good suggestion on the field type. 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
FREE
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events