I'm trying to clear a form value from the linked-issues field using behaviours.
I've tried the following three ways and none seems successful:
def rt = getFieldById(getFieldChanged())
def links = getFieldById("issuelinks")
def linkType = getFieldById("issuelinks-linktype")
def linkIssues = getFieldById("issuelinks-issues")
def rtValue = rt.getValue()?.toString()
switch(rtValue) {
case "Duplicate":
links.setHidden(false)
linkType.setFormValue("duplicates").setReadOnly(true)
linkIssues.setRequired(true)
break
default :
links.setHidden(true)
linkType.setFormValue(-1).setReadOnly(false)
//None of these seem to work correctly//
linkIssues.setRequired(false).setFormValue("") <--- FIRST WAY
linkIssues.setRequired(false).setFormValue(null) <- SECOND WAY
linkIssues.setRequired(false).setFormValue(-1) <--- THIRD WAY
break
}
Any assistance would be appreciated!
Regards,
Steven Mustari
from scriptrunner support:
This is a bug: SRJIRA-5851
linkIssueField.setDescription("<script>AJS.\$('#issuelinks-issues').val(''); AJS.\$('#issuelinks-issues-multi-select .representation .items em.item-delete').click()</script>")
Instead of setFormValue("") and all the other options I've tried, we're using JavaScript to remove the linkIssueField value.
Need a help, is there a way to restrict the search also for this issue link field, lets say i want the issue to come up for one project only which must be available for users to link?
Regards
Vishal Goel
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
From which screen are you trying to accomplish this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Mathis Hellensberg
From a transition screen. Everything is working correctly except for clearing the value of "linkIssues".
The only problem are the following lines:
linkIssues.setRequired(false).setFormValue("")
linkIssues.setRequired(false).setFormValue(null)
linkIssues.setRequired(false).setFormValue(-1)
Regards,
Steven Mustari
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What kind of field is linkIssues? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Mathis Hellensberg
It's half of the composite system field "issueLinks".
It can be broken down into editing either of the two sub-fields:
issueLinks-linktype:
issueLinks-issues: (This is the field I'm trying to clear)
Here is a link to the documentation explaining this.
Thank you for your help,
Steven Mustari
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.