Hi,
Jira version: v9.5.0
Using scriptrunner
I have a issue type "Feature"
I have created a issuePicker custom field called "Feature link", that I want to hide when "Epic Link" is present in Story. The motivation here is that a story can either be connected to Epic or to Feature and not both.
In the issue edit mode, when I enter the epic link, the "parent link" drop-down option of "parent link" disappears instantly however field name and help text is remaining. In case of custom field "feature link", the drop down menu is still visible.
The behavior script on Field "Feature Link" that I am using
import com.atlassian.jira.issue.IssueFieldConstants
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScript
@BaseScript FieldBehaviours fieldBehaviours
def epicField = getFieldByName("Epic Link")
def featureField = getFieldByName("Feature Link")
if (epicField.value) {
featureField.setReadOnly(true)
featureField.setHelpText("Cannot use Feature Link when Epic link is set.")
}
else if (!epicField.value) {
featureField.setReadOnly(false)
featureField.setHelpText("")
}
Any suggestions about that how to make the "Feature Link" drop-down to dis-appear.
Another question in continuation to it:-
Once "Feature Link" custom field has Jira number and later I put the Epic Link, eventhough the "Feature Link" field is readonly but has Jira number. Is there any way to reset the field value to placeholder text "Select Feature"
Br.
Alok
You're likely looking to use `FormField#setHidden(true)` which should remove the field from the form completely (well, not remove, hide).
Once "Feature Link" custom field has Jira number and later I put the Epic Link, eventhough the "Feature Link" field is readonly but has Jira number. Is there any way to reset the field value to placeholder text "Select Feature"
I'd probably try something like
featureField.setFormValue(null)
A null should be a valid value no matter the field type as far as I know.
You would though need to pin that behaviour on the 'Epic Link' field - so that the behaviour will execute when the field is updated (i.e., someone setting a value). As normally as a server side behaviour it will just run once the form loads, but to make it trigger on field changes, the script has to be attached to the field.
Thanks for the tips, they worked. Setting to null solved the issue.
featureField.setFormValue(null)
Attaching to "Epic Link" field was the one I was missing. I was attaching my behavior to "Feature Link" and that was not right.
"featureFeild.setHidden(true)" function also hides the helptext, However I want to show it to the user the helptext about why user can not select the feature link.
I have another question for that I create another discussion and not messing it here.
Once again thanks.
Br
Alok
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.