Option in resolution field must force other fields

Yuri Edward Schulze October 21, 2022

We need to create an automation so that when an option in the resolution field is selected (Ex: Completed), some custom fields appear and set as mandatory.
We made a script, but as the Resolution field is a standard system field, this automation is not working.
Could you help me to assemble this script?

2 answers

0 votes
Ram Kumar Aravindakshan _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.
October 23, 2022

Hi @Yuri Edward Schulze

For your requirement, you need to use a Server-Side Behaviour for the Resolution field to ensure that the Behaviour will trigger only when a change is made to the Resolution field.

Below is a sample code for your reference:-

import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript

@BaseScript FieldBehaviours behaviours
def resolution = getFieldById(fieldChanged)
def resolutionValue = resolution.value.toString()

def comment = getFieldById('comment')
comment.required = false

if (resolutionValue == 'Done') {
comment.required = true
}

Please note that the sample code provided above is not 100% exact to your environment. Hence, you will need to make the required modifications.

Below is a screenshot of the Behaviour configuration for your reference:-

image1.png

I hope this helps to answer your question. :-)

Thank you and Kind regards,

Ram

0 votes
Fabio Racobaldo _Herzum_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 22, 2022

Hi @Yuri Edward Schulze ,

you can use a behaviour for this purpose.

Resolution filed can be retrieved using :

def resolution = getFieldById("resolution")

if("Done".equalsIgnoreCase(resolution.getValue())){

...

}

Hope this helps,

Fabio

Suggest an answer

Log in or Sign up to answer