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:
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.
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:
<dependency>
<groupId>com.atlassian.jira</groupId>
<artifactId>jira-api</artifactId>
<version>
8.5
.
5
</version>
</dependency>
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
<version>3.0.6</version>
<type>pom</type>
</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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Sure, I can try to help but do you have some code so we can discuss something real? :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.