Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

This article provides the code snippet to create a new issue in a different Jira Cloud instance using callRest filter and Atlassian Jira REST API

\uD83D\uDCD8 Instructions

  1. Navigate to the intended workflow to make the necessary changes in the edit mode.

  2. Select the required transition.

  3. Select the Post functions tab and click Add post function.

  4. Add the Build-your-own (scripted) Post-function post-function with the below template:

    Code Block
    languagejava
    {{ "https://<URL>/rest/api/3/issue" | callRest(verb=("post"),
                   body= {
                        "fields": {
                       		"project": {
                            	"key":"JSM"
                                },
                            "summary": "From JMWE post-function",
                             "issuetype": {
                                      "id": "10006"
                                      },
                                      "customfield_10064": "val 1"
    					}
                   },
                   options= {
    					headers: {
    						"authorization": "Basic XXXXXXXXXX"
    					}
    				}) | dump(2) }} 

...

  • <URL> in line #1 with the target Jira Cloud instance URL

  • JSM in line #5 with the target project key

  • From JMWE post-function in line #7 with the desired summary

  • 10006 in line #9 with the target issue type id

  • 10064 and val 1 in line #11 with the id and value of a customfield that you want to set in the new issue. Add other fields as needed (check this)

  • XXXXXXXXXX in line #16 with your API token - check this.

...

References

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@4371b12
sortmodified
showSpacefalse
reversetrue
typepage
cqllabel in ( "kb-how-to-article" , "nunjucks-template" , "nunjucks" , "script" , "code" , "post-function" ) and type = "page" and space = "JMWEC"
labelskb-how-to-article

...