You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
I'm trying to use a Scriptrunner post function to create an issue in a different project.
One of the target customfields is a select list, and I'm trying to working out how to set this field value.
I can see how to do this using getRelevantConfig for the same project, but I don't have this field in my source project, and I can't see how to get this config for a different project when I haven't created the task yet,
The getRelevantConfig method can take an issue object. That's probably what you've seen and used.
But it can also use an issueContext object.
So you so can create a new context based on the project and issue type you plan to create then call the getRelevantConfig with that object to get the options.
Something like this:
def projectId = 123456L
def issueTypeId = '10010'
def cfId = 10001L
def issueContext = new IssueContextImpl(projectId, issueTypeId)
def customField = ComponentAccessor.customFieldManager.getCustomFieldObject(cfId)
def config = customField.getRelevantConfig(issueContext)
def options = ComponentAccessor.optionsManager.getOptions(config)
That's perfect, many thanks for your clear and quick reply. That's working very nicely for me now. Thanks again