We want to open create JIRA issue form on click of a button

Abhishek Barnwal December 30, 2021

When we hover on the text in confluence page, it gives an option to create JIRA issue. We want to open the same JIRA issue create form on click of a button. We have scriptrunner for confluence. I have added an approve button on the confluence page. Requirement is once the user clicks on the approve button JIRA issue create form should popup.

 

Thanks!

3 answers

1 vote
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 30, 2021

For server, I would create a user macro to provide the approve button and link to the issue create screen - you can't put it in as part of a Confluence page, it would have to be a callout to Jira.

Or use a Jira "issue collector" in your space or global headers.

Or consider Confluence forms with SR - https://library.adaptavist.com/entity/create-jira-issue-from-forms-for-confluence-submission

Abhishek Barnwal December 30, 2021

Is there a way we can call JIRA macro using scriptrunner?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 31, 2021

You don't need to call the Jira macro with Scriptrunner, you can use the Jira macro directly in the body of your page.

You can alter the Confluence UI with Scriptrunner though - see https://docs.adaptavist.com/sr4c/latest/features/script-fragments and those could be used to call scripts.

Abhishek Barnwal December 31, 2021

I use below snippet to insert the JIRA issues using automation for dynamic creation of confluence pages.

JIRA insert issue macro

<ac:structured-macro ac:name='jira' ac:schema-version='1'><ac:parameter ac:name='columns'>component,type,key,summary,created</ac:parameter><ac:parameter ac:name='maximumIssues'>20</ac:parameter><ac:parameter ac:name='jqlQuery'>'project=ABC'</ac:parameter></ac:structured-macro>

 

Is there any code for JIRA Create issue macro ?

0 votes
Lukasz Sielski February 3, 2022

Hi,

you can play around with this, create rest endpoint with this code

and call it using script fragment. 


import com.onresolve.scriptrunner.runner.rest.common.CustomEndpointDelegate
import groovy.transform.BaseScript
import javax.ws.rs.core.MultivaluedMap
import javax.ws.rs.core.Response
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.util.BaseUrl



@BaseScript CustomEndpointDelegate delegate

def constantsManager = ComponentAccessor.getConstantsManager()
def commsIssueType = constantsManager.getAllIssueTypeObjects()

customCreateSubTask(httpMethod: "GET") { MultivaluedMap queryParams ->

// getting information about current issue and base url
def BaseUrl baseUrl = ComponentAccessor.getComponent(BaseUrl)
def String parentIssueKey = queryParams.getFirst("key")
def parentIssue = ComponentAccessor.issueManager.getIssueByCurrentKey(parentIssueKey)
def parentIssueID = parentIssue.getId()

// creating url for response
def URL = baseUrl.getBaseUri().toString()
URL = URL + "secure/CreateSubTaskIssue!default.jspa?parentIssueId=${parentIssueID}&issuetype=xxxxx" //issuetype if needed
URL = URL.toURL()

Response.temporaryRedirect(URI.create("${URL}")).build()
}
0 votes
Fabian Lim
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
December 30, 2021

Adding @Nic Brough -Adaptavist-

I'm also interested on this one.  

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events