Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Smart value for listing all the available options in multi select custom field

Raju Mandapaka
Contributor
September 2, 2022

Team,

I am having a custom field (multi select) which are having a drop down options like A, B, C, Now is there any smart value where i can show all the options which are available in that custom field, even though specific issue is having only B & C as values.

 

Thanks,

Raju

2 answers

1 accepted

0 votes
Answer accepted
Felix
October 19, 2017

Came across this git https://gist.github.com/jechlin/9789183 and adapted the code a bit to fit my needs.

import com.atlassian.greenhopper.service.sprint.Sprint
import com.atlassian.greenhopper.service.sprint.SprintIssueService
import com.atlassian.jira.component.ComponentAccessor
import com.onresolve.scriptrunner.runner.customisers.ContextBaseScript
import com.onresolve.scriptrunner.runner.customisers.JiraAgileBean
import groovy.transform.BaseScript

@BaseScript ContextBaseScript baseScript
def issue = getIssueOrDefault("TP-1")

@JiraAgileBean
SprintIssueService sprintIssueService

def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def sprintsForIssue = sprintIssueService.getSprintsForIssue(loggedInUser, issue)
Sprint activeSprint = sprintsForIssue.getValue().find{it.active}

if (activeSprint) {
log.info "Adding issue $issue to ${activeSprint.name} with sprint id ${activeSprint.id}"
sprintIssueService.removeIssuesFromSprint(currentUser, activeSprint, [issue] as Collection)
}
else {
log.info ("could not find active sprints for isse ${issue.key}")
}

 

Are there any other suggestions? :) 

0 votes
Gregor Kasmann_Actonic
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
October 19, 2017
Felix
October 19, 2017

Thanks for the suggestion! If it's not working using the Java API, I will give it a try! However, I would prefer the "Java API" way.

Suggest an answer

Log in or Sign up to answer