script runner jira

Hi, I followed the instruction to activate the script runner, but still struggling with the xml samples. I may miss some important info, please help.

Also where can I find documentation about the JIRA classes?

Thank you.

Groovy samples run ok:
import com.atlassian.jira.ComponentManager
def projectManager = ComponentManager.getInstance().getProjectManager()
def result="";
def pcount=0;
for(p in projectManager.projects) { pcount ++; }

result = "Project count:"+pcount
return result;

3 answers

Hi Hoan,

Which XML samples are you referring to?

You can find documentation about the product here: https://jamieechlin.atlassian.net/wiki/display/GRV/Script%20Runner

Documentation about JIRA api here: https://developer.atlassian.com/static/javadoc/jira/6.3.15/reference/packages.html

Thanks for your reply.

Basically, I would like to create an automation process to create groups, create users, then assign users to groups. Those xml I tried are:

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
<jira:CreateGroup group-name="jelly-group1"/>
</JiraJelly>

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
<jira:CreateUser username="jelly-user1" password="passord1" confirm="passord1"
fullname="jelly-user-001" email="jelly.user001@test.com"/>
</JiraJelly>

<JiraJelly xmlns:jira="jelly:com.atlassian.jira.jelly.JiraTagLib">
<jira:AddUserToGroup username="jelly-user1" group-name="jelly-group1"/>
</JiraJelly>


 

 

Look at com.atlassian.jira.security.groups.GroupManager and com.onresolve.scriptrunner.canned.confluence.utils.UserUtils

The xml scripts above are not working. How can I run them as xml?

I am going to use groovy and JIRA api. No need for xml anymore. You can close this case. There are many good examples for groovy. Thank you Jamie for the script engine and samples smile.

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Oct 31, 2018 in Marketplace Apps

Marketplace Spotlight: Zephyr

Hello Atlassian Community! Each month, we run a series of Spotlights to highlight Marketplace vendors and apps that our team thinks this Community would find valuable. In last month's Spotlig...

320 views 0 1
Read article

Atlassian User Groups

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

Find a group

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

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you