Skip to end of metadata
Go to start of metadata

Problem:


Is there a possibility to create Jira Issues due the API of Jira with the Signavio Workflow Accelerator?



Solution:


With the JavaScript Task is it possible to connect to 3rd party systems.

You can use the following code snippet.

Please keep in mind. Signavio will not take any responsibility for the code. Please test it in a developer/test environment before use it in production system.

Example create Jira Issue
// Create Jira issue: add a 'product feedback' issue to the selected project.

// Look up JIRA project details by product name.
const projects = {
  'My Project': {key: 'MY'},
  'My Other Project': {key: 'MOP'}
}
// Issue type ID
const productFeedback = 11101
const jiraProject = projects[projectName]
const newIssueUrl = 'https://jira.example.com/rest/api/2/issue/'
const user = 'myuser'
const password = 'mypassword'

const issueBody = {
  fields: {
    project: { key: jiraProject.key },
    summary: `${feedbackType}: ${summary}`,
    description: issueDescription,
    issuetype: { id: productFeedback }
  }
}

const requestOptions = {
  url: newIssueUrl,
  auth: { username: user, password: password },
  body: issueBody,
  json: true
}

const handleResponse = (error, response, body) => {
  if (error) {
    throw error
  }
  console.info(`HTTP ${response.statusCode} ${response.statusMessage}`)
  if (response && response.statusCode >= 400) {
    throw new Error(`Error: ${response.statusCode}\n${JSON.stringify(body)}`)
  }
  jiraIssueKey = body.key
  issueLink = `https://jira.example.com/browse/${body.key}`
}

request.post(requestOptions, handleResponse)

For Onpremise Systems you have to install NodeJS and Script-Engine.