How to make required field based on Resolution field value is "Fixed"

Omprakash Thamsetty
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.
February 13, 2019

Does anyone got it work. Root Cause field required based on Resolution field value selection to "Fixed". In the transition form if user select "Fixed" for Resolution field then "Root Cause" field should set to required otherwise no. How I can achieve this?

User will select the Resolution field value when doing close transition so if user select "Fixed" then "RootCause" value should required otherwise no. 

Can anyone help me to achieve this.

Thanks,

Om

4 answers

1 accepted

1 vote
Answer accepted
Omprakash Thamsetty
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.
February 13, 2019

I made through Behavior

 

import com.atlassian.jira.issue.resolution.Resolution

def RootC = getFieldById("customfield_13502")
def ResF = getFieldById("resolution")
def ResfVal = ResF.getValue() as Resolution

RootC.setHidden(true)

if(ResfVal.name == 'Fixed'){
    RootC.setHidden(false)
    RootC.setRequired(true)
}else{
    RootC.setHidden(true)
    RootC.setRequired(false)
}
0 votes
Tenzing Doleck April 12, 2023

Hello- can anyone help with doing this in cloud ?

Thanks!

0 votes
Alexey Matveev
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.
February 13, 2019

Hello,

You would need a plugin for it.

For example, you could use the Power Scripts add-on:

https://marketplace.atlassian.com/apps/43318/power-scripts-jira-script-automation?hosting=cloud&tab=overview

You could add the SIL validator with a code like this:

if (resolution == "Fixed" and isNull(#{Root Cause})) {

 return false, "Root Cause must be set";

}

return true;
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

Wasn't there a posting rule not to promote own plugins? Maybe the rules changed ...

Like Nic Brough -Adaptavist- likes this
Alexey Matveev
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.
February 13, 2019

I gave a working example. It can be used. 

Alexey Matveev
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.
February 13, 2019

And I do not think it can be done out of the box. As far as I understand there can be different resolutions in the Closed status, not only fixed. And your example works, only if there is always the fixed resolution in the Closed status.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

@Thomas Deiler- that's why I tend to use "Scripting or automation tools".  My sales guys would love me to heavily plug SR all the time, but I try to stick to what Alexey has done here - a working example.  If I don't have the example to hand, a non-advert generalisation is better.

(If I must... SR has two ways to do this.  A validator similar to the Power Scripts, but also a Behaviour could do it on-screen before the user commits a change)

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

I gave a working example. It can be used.

Sorry. Didn't now that rule - anyhow I find it personally not that ideal.

And your example works, only if there is always the fixed resolution in the Clos
ed status.

you can set any resolution by the workflow within a transition that will go to one status, not only "fixed". If you have for example 5 different resolutions you can create 5 transitions that are named like the resolution. In echh transition the resolution is set in a post function. What Omprakash requested to do, to make the field "Root Cause" just mandatory for the "Fixed" thing will work. Sure, during the other transitions the field is not displayed.

My sales guys would love me to heavily plug SR all the time

Fine, Nic, that you jump in for Alexey. Most readers will not know who both you are. Lets stop it here - we can continue in "our" space. In respect of our community ...

Omprakash Thamsetty
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.
February 13, 2019

@Nic Brough -Adaptavist-how can we do in behaviour ? How to check on screen/transition screen value for Resolution field and then make the filed required ? How to read transition screen value ?

Alexey Matveev
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.
February 13, 2019

@Thomas DeilerIn my opinion to create five transitions to handle five resolutions is not an ideal solution. But it is up to the reporter to decide.

Omprakash Thamsetty
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.
February 13, 2019

@Alexey MatveevMy organization may not be intrusting to buy paid plugin. We have script runner plugin already.

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

Hey @Nic Brough -Adaptavist-, its your lucky day ;)

0 votes
Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

Dear @Omprakash Thamsetty,

your conditioned field-case will not work with standard Jira. But you could do following with the same effect:

  • Create two custom screens
  • One with "Root Cause" and the other without
  • Make Root Cause mandatory
  • Add two transitions to your final status the one named "Fixed" using the screen with Root Cause the other transition named "Something else than fixed" using the screen without Root Cause
  • The field resolution is set automatically (post function in WF) during the transition so the user doesn't need to add anything
  • To avoid blocking issue editing because of the mandatory field "Root Cause" that is valid for all screens of at least one issue type, you can fill it with a default text like <add a root cause>  (edit custom field)
  • et voila: works like a charm :)

So long

Thomas

Omprakash Thamsetty
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.
February 13, 2019

@Dear @Thomas Deiler look like this work but only thing is users should click on appropriate transition like "Fixed" or "Close" transition. If Fixed transition clicked by user then root cause field will be required. If user choose Close transition then root cause field may not be appear. But here challenging is users should select the appropriate .

Thomas Deiler
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 13, 2019

Sure, but it is also challenging to select the right one from the resolution drop-down. It's the same but different located.

Suggest an answer

Log in or Sign up to answer