It's not the same without you
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
I am trying to build a Single Select List of Issue Keys that are in the current project that is related to the issue.
I figured that the Behaviour plugin with server side script would be the way to go.
The idea is to get all the Keys from the project and allow the user to select one, however I get a validation error.
import com.onresolve.jira.groovy.user.FieldBehaviours import com.onresolve.jira.groovy.user.FormField import com.atlassian.jira.ComponentManager import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.component.ComponentAccessor import org.apache.log4j.Category def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction") log.setLevel(org.apache.log4j.Level.DEBUG) log.info("Starting Behaviour GroovyScript PopulateIssueIds") def issueId = formContents["id"] def issue = ComponentManager.getInstance().getIssueManager().getIssueObject(issueId as Long) def project = issue.getProjectObject() def issuesIds = ComponentAccessor.getIssueManager().getIssueIdsForProject(project.getId()) def issues = ComponentAccessor.getIssueManager().getIssueObjects(issuesIds) Map fieldOptions = [:] fieldOptions.put("-1","None") for(MutableIssue tempIssue : issues){ log.debug("ID: "+tempIssue.getKey()) fieldOptions.put(tempIssue.getId(),tempIssue.getKey()) } FormField targetIssue = getFieldById("customfield_11803") targetIssue.setFieldOptions(fieldOptions)
The population of the list works
But when I try to transition the issue I get an error
Invalid value '13915' passed for customfield 'Target Issue'. Allowed values are: , -1
I suspect it because these values are not defined in the Custom Field as valid options?
Is there something I am doing wrong here or am I limted to only having predefined values, even if I can reduce the options shown?
If so is there some other approach that could acheive the same goal?
This community is celebrating its one-year anniversary and Atlassian co-founder Mike Cannon-Brookes has all the feels.
Read moreHey Atlassian Community! Today we are launching a bunch of customer stories about the amazing work teams, like Dropbox and Twilio, are doing with Jira. You can check out the stories here. The thi...
Connect with like-minded Atlassian users at free events near you!
Find a groupConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.
Start an AUGYou're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.