Does anyone know how to set the Summary in a Jira issue as a Confluence page title using Scriptrunner for Confluence?
That should be quite doable. The particulars will depend a bit on the context. Do you want this to happen in a one-off script from the Script Console? Do you want this to happen on a schedule using a Script Job? Or in response to an event via a Listener?
The main idea would be to get the Page object that you want to extract the title from, then contact Jira to update the particular issue via its issue REST API. If the Jira instance is linked, then this is somewhat easier to do. See the documentation on using App Links for details.
Those are the pieces. If you can be a little more specific we might be able to provide a more stitched-together example. For starters, you should have a look at the Jira-specific examples in our documentation.
Thank you, here's the outline I'm currently using
// you have to have ScriptRunner for JIRA Cloud addon installed in order to use this example
def projectKey = 'SAM'
def taskType = get('/rest/api/2/issuetype').asObject(List).body.find { it['name'] == 'Task' }['id']
Map result = post('/rest/api/2/issue')
.header('Content-Type', 'application/json')
.body(
[
fields: [
summary : 'A new page was created',
description: "A page was created by ${page.creatorName} with title: '${page.title}' in space: '${page.spaceKey}'",
project : [
key: projectKey
],
issuetype : [
id: taskType
]
]
])
.asObject(Map).body
logger.info("Issue has been created " + result.self)
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.