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?
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:-
I hope this helps to answer your question. :-)
Thank you and Kind regards,
Ram
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.