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.
Project name is
issue.projectObject.name
and summary is:
issue.summary
You already have the code for creating the page in confluence, so you just need to plug those values in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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")
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.
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.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
Rumi
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.