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.BaseScriptimport com.onresolve.jira.groovy.user.FieldBehavioursimport com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.config.ResolutionManagerdef resolutionManager = ComponentAccessor.getComponent(ResolutionManager)@BaseScript FieldBehaviours fieldBehavioursdef resolution = getFieldById("resolution")def resolutionValue = resolution.formValue.toString()def abortwhy = getFieldById("customfield_10111")abortwhy.hidden = trueif (resolutionValue == "3" ) { abortwhy.hidden = false}
Thanks in advance.
Try the below and let me know
if (resolutionValue == "Abort" ) {
. If it works, please mark the answer as accepted.
Thanks,
Aditya Sastry
Thanks but unfortunately, I tried that in the first place and it didn't work.
Hi Sabine,
I tried the below code in my instance and it worked. can you please check?
import com.atlassian.jira.issue.resolution.Resolutiondef AbortRelease = getFieldByName("Abort Why")def resolutionField = getFieldById("resolution")def resolution = resolutionField.getValue() as ResolutionAbortRelease.setHidden(true)if(resolution.name == "Abort"){AbortRelease.setHidden(false)}else{AbortRelease.setHidden(true)}
Aditya
@Sabine Van Regenmortel did it work for you? If yes, please mark the answer as accepted.
It looks like you're new here. Sign in or register to get started.