Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Scriptrunner - getRelevantConfig For Different Project

Dalectric
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 Leaders.
Jan 06, 2023

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,

1 answer

1 accepted

1 vote
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Jan 10, 2023

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:

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.context.IssueContextImpl
import com.atlassian.jira.issue.fields.CustomField

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)
Dalectric
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 Leaders.
Jan 11, 2023

That's perfect, many thanks for your clear and quick reply. That's working very nicely for me now. Thanks again

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events