Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Looking for options for coding large scriptrunner console scripts to combine custom field contexts

I see plenty of discussion on tools for splitting projects into separate custom field contexts.

However, I have a need to move projects from one context to another context, and then updating the values of the fields so that they show correctly for the new context.

(if you just move a project to a new context, the field values display correctly, but when editing the record, they are not selected at all.  This is why I want to update the moved records to use the correct options for the new context)

I have both parts working individually:

  • I can move a project from one context to another
  • I can update the field value of the issues in the moved project, so that they show as chosen when editing the record.

However, both of these are somewhat complex (as least due to how I code)

I was wondering if there are any scripting tools that allow me to develop this work in a more IDEish way.  I know that IntelliJ was an option with ScriptRunner 6.0, but it seems this is no longer an option with later versions of ScriptRunner.

I'm not trying to write an addon, so I don't what to try to figure that out.

1 answer

1 accepted

0 votes
Answer accepted

Hi @Kevin Ketchum we are using IDEA and it works nice. We need to create maven project to have dependencies available but it works.

You need to add at least Jira API dependency and groovy dependency:


Is this what you're looking for?

Thanks for the suggestion.

I spend some time looking into this and I wasn't successful in getting it to work.

I suppose staying within the scriptrunner console but working on my code structure will be a more effective use of my time now.

Hi @Kevin Ketchum and what is the exact problem? You are not able to create maven project? Or you created it and it does not work?

I was unable to figure out the code for managing customfields, and their contexts.

It's a knowledge limitation on my part, and I am probably over my head.

In any case, I thank you for responding and offering this information.


However, if you have any examples you'd be willing to share. I'd gladly review them to see they help me get beyond my limitations.

Sure, I can try to help but do you have some code so we can discuss something real? :)

In ScriptRunner Console, one of the basic scripts I run looks like this:

//Get the list of active users that do not have an employee number property set
import com.atlassian.jira.component.ComponentAccessor
def userPropertyManager = ComponentAccessor.getUserPropertyManager()
def userManager = ComponentAccessor.getUserManager()
def sb = new StringBuffer()
def uc = 0
sb.append("count,username,userkey,employee #<br>")
for (def user in userManager.allUsers) {
def employeenumber = userPropertyManager.getPropertySet(user).getString("jira.meta.Employee Number")
if (user.isActive() && employeenumber == null) {
sb.append(uc+ ",\"" +user.displayName + "\"," + user.getUsername() + "," + employeenumber + "<br>")
log.error("Found " + uc + " users with no Employee Number")
return sb.toString()

Obviously, running this outside of ScriptRunner, I would need to know what java classes to import and how to authenticate.

I am unfamiliar with these basic operations in IDEA.

Thank you @Kevin Ketchum for your response. You can't run the script outside Jira. It must be deployed on Jira server because it must be ran under JVM process. But you can copy the script to server using SSH and just execute it.

Is it what you're looking for?

OK - thanks for the info.  I'll see where that gets me.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published in Jira Service Management

JSM June Challenge #2: Share how your business teams became ITSM rockstars

For JSM June Challenge #2, share how your non-technical teams like HR, legal, marketing, finance, and beyond started using Jira Service Management! Tell us: Did they ask to start using it or...

335 views 9 7
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you