Hi,
We use resolution value Abort (ID 3) accompanied with a custom field Abort Why.
This is handled in a workflow transition. But still users must be able to modify it after the transition in the Edit screen.
Therefore I only want the Abort Why field to appear when resolution = 'Abort'.
I started by this behaviour with groovy script by googling and copy pasting.
It is a server side script on the custom field Abort Why.
It doesn't work. Only the hiding works, but not the resolution condition.
import groovy.transform.BaseScript
import com.onresolve.jira.groovy.user.FieldBehaviours
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.config.ResolutionManager
def resolutionManager = ComponentAccessor.getComponent(ResolutionManager)
@BaseScript FieldBehaviours fieldBehaviours
def resolution = getFieldById("resolution")
def resolutionValue = resolution.formValue.toString()
def abortwhy = getFieldById("customfield_10111")
abortwhy.hidden = true
if (resolutionValue == "3" ) {
abortwhy.hidden = false
}
Thanks in advance.
Hi,
Try the below and let me know
if (resolutionValue == "Abort" ) {
. If it works, please mark the answer as accepted.
Thanks,
Aditya Sastry
Hi,
Thanks but unfortunately, I tried that in the first place and it didn't work.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Sabine,
I tried the below code in my instance and it worked. can you please check?
import com.atlassian.jira.issue.resolution.Resolution
def AbortRelease = getFieldByName("Abort Why")
def resolutionField = getFieldById("resolution")
def resolution = resolutionField.getValue() as Resolution
AbortRelease.setHidden(true)
if(resolution.name == "Abort")
{
AbortRelease.setHidden(false)
}
else
{
AbortRelease.setHidden(true)
}
Thanks,
Aditya
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Sabine Van Regenmortel did it work for you? If yes, please mark the answer as accepted.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Aditya,
Thanks again for the effort. I would like to accept your resolution.
However, the script shows a green bullet but unfortunately it doesn't work.
It even doesn't hide the field in any case.
I both set it on field Resolution and Abort Why. Without initializer.
And also only on initializer.
Is your Abort Why field a radio button field? On which field did you set the script?
Thanks,
Sabine
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.