How to get project name through groovy script to use under script runner plugin

HOw to get project name under "title" field and its summary under content field of a page while creation of automatic page using script post function under a create issue.

1 answer

1 accepted

Project name is

and summary is:


You already have the code for creating the page in confluence, so you just need to plug those values in.

javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: issue for class: Script37
issue should be written as issue or name of the issue...

issue is correct if you are running it from a post-function. If you are running it from the admin panel for testing you will need to get an issue yourself, eg:

def componentManager = ComponentManager.getInstance()
def issue = componentManager.getIssueManager().getIssueObject("JRA-1306")

ok will try creating post function.

Basically I have added custom field as "project name" under the create issue.

so I just want to fetch the value inside that customfield and place it as the title of mypage.

if u can tell me how to getvalue of that custom field i think the work would be done for me.


Why didn't you say project name was a custom field?

ComponentManager componentManager = ComponentManager.getInstance()
CustomFieldManager customFieldManager = componentManager.getCustomFieldManager()

def cf = customFieldManager.getCustomFieldObjectByName("Project Name")
issue.getCustomFieldValue(cf) // project name

Actually I was first trying out with the project name of every project name I create in jira but that was not serving my purpose as I wanted to have different pages for every different issue under the same project. So I made a customfield to capture the unique project name for each issue.

Thanks for the answer as it is exactly what I wanted to get.

Hi Jamie,

perhaps my need is similar to this:

I have a custom field which options are the current project names of the Jira instance. But the project leads often change the name of the projects so - there about 200 projects we handle - it is cumbersome to update the options regularly.

Can you please send me a groovy script which result the list of the current project names (not keys!)? I have Behaviour plugin, so I thought I will add this script to this custom field in behaviour.

With Scripted field it would be the most simplest of course but we have an older version of Script Runner because our version 4.3 Jira.

Can you please suggest?

Thanks in advance!

Suggest an answer

Log in or Sign up to answer
Community showcase
Published Mar 13, 2019 in Marketplace Apps

Marketplace Spotlight: Marketing apps for Confluence to keep your teams working on the same page


242 views 0 6
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