Hello all
We have recently introduced Cherwell to Jira integration so the service desk can create Issues and if there is a need for Development tasks. There is a "button" in Cherwell called "Send to Jira" which will create Issue in Jira.
This all works fine...
What I'm trying to automate now is the process when the Issue in Jira is solved and backward update of the Cherwell ticket.
Is Jira able to send Rest API call to Cherwell when the Issue is marked as DONE to update the status in Cherwell?
Thank you very much
# Variables
$cherwellBaseUri = "https://your-cherwell-instance.com/CherwellAPI"
$cherwellUsername = "cherwellUsername"
$cherwellPassword = "cherwellPassword"
$cherwellIncidentId = "12345"
$jireBaseUri = "https://your-jira-instance.com/rest/api/2"
$jiraUsername = "jiraUsername"
$jiraPassword = "jiraPassword"
$jiraIssueKey = "PROJECT-123"
# Function to get Cherwell OAuth token
function Get-CherwellOAuthToken {
$authHeader = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$cherwellUsername:$cherwellPassword"))
$response = Invoke-RestMethod -Method Post -Uri "$cherwellBaseUri/token" -Headers @{Authorization = $authHeader} -ContentType "application/x-www-form-urlencoded" -Body "grant_type=password"
return $response.access_token
}
# Function to download attachment from Cherwell
function Download-CherwellAttachment {
param (
[string]$incidentId,
[string]$accessToken
)
$headers = @{ Authorization = "Bearer $accessToken" }
$attachments = Invoke-RestMethod -Method Get -Uri "$cherwellBaseUri/api/V1/getbusinessobjectattachments/busObId/$incidentId" -Headers $headers
foreach ($attachment in $attachments.attachments) {
$fileName = $attachment.fileName
$fileUri = "$cherwellBaseUri/api/V1/getbusinessobjectattachment/$attachment.attachmentId"
Invoke-RestMethod -Method Get -Uri $fileUri -Headers $headers -OutFile $fileName
return $fileName
}
}
# Function to upload attachment to Jira
function Upload-JiraAttachment {
param (
[string]$fileName
)
$authHeader = "Basic " + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes("$jiraUsername:$jiraPassword"))
$headers = @{
Authorization = $authHeader
"X-Atlassian-Token" = "no-check"
}
$form = @{
file = Get-Item $fileName
}
Invoke-RestMethod -Method Post -Uri "$jireBaseUri/issue/$jiraIssueKey/attachments" -Headers $headers -ContentType "multipart/form-data" -InFile $fileName
}
# Main script execution
try {
# Get Cherwell OAuth token
$cherwellToken = Get-CherwellOAuthToken
# Download attachment from Cherwell
$downloadedFileName = Download-CherwellAttachment -incidentId $cherwellIncidentId -accessToken $cherwellToken
# Upload attachment to Jira
Upload-JiraAttachment -fileName $downloadedFileName
Write-Output "Attachment successfully copied from Cherwell to Jira."
} catch {
Write-Output "An error occurred: $_"
}
Hey guys,
You can check out this tool https://marketplace.atlassian.com/apps/1224485/zigiops-integrate-jira-with-cherwell?hosting=cloud&tab=overview.
We are using it for systems integrations and its working quite well.
Hope this helps!
Cheers,
Eric
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you please share some inputs how integrate Cherwell with Jira ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can we please get your help to implement below
We have recently introduced Cherwell to Jira integration so the service desk can create Issues and if there is a need for Development tasks. There is a "button" in Cherwell called "Send to Jira" which will create Issue in Jira.
I appreciate your help with this.
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.