Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using the Jira Command Line Interface to create an issue with a multi-line description

Ryan_Taylor May 7, 2020

I am using a PowerShell script to read in issue details like Summary and Description. For each PSObject in my array I want to call the acli.bat to create an issue. Everything works except for multi-line descriptions. Only the first line is ever output to my generated ticket. Here is a code sample...

Import-Csv -Path ".\issues.csv"ForEach-Object {
.\acli.bat --action createIssue `
    --server "$server" `
        --user "$user`
     --password "$password`
      --project TEST `
        --type Task `
--summary $_.Summary `
--description 
$_.Description `
}

While I have used runFromCsv in other projects to import tickets, even those with multiple line descriptions, I do not want to directly runFromCsv in this case as I need to make modifications on the fly.

How do I do this?

I am using Jira Software (Server) 8.5 and the Atlassian CLI 9.2

2 answers

1 vote
Ryan_Taylor May 7, 2020

I have found a solution.

  1. Write the description to a file
  2. Replace --description $_.Description with --file ".\desc.txt"
  3. Ponder other mysteries of the universe

The full setup is then

Import-Csv -Path ".\issues.csv"ForEach-Object {
$_.Description | Set-Content -Path ".\desc.txt" -Encoding "UTF8"
.\acli.bat --action createIssue `
    --server "$server" `
        --user "$user`
     --password "$password`
      --project TEST `
        --type Task `
--summary $_.Summary `
--file ".\desc.txt

}

This add a fair bit more file I/O to my operation as we write this for every record we're making and I have hundreds of tickets to make (porting). I'll need to do this for comments too assuming the --file method works on comments.

Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 8, 2020

I'm glad you found a solution. Understand about the file IO.  RunFromCSV or Run with a file containing a line for each action is the supported method, but I understand that won't work for you.

0 votes
Michael Kuhl {Appfire}
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 7, 2020

Hi @Ryan_Taylor - Have you tried wrapping $_.Description in double quotes (") so that it get's passed intact to acli.bat?

Ryan_Taylor May 7, 2020

Unfortunately that does not work. I also tried "$($_.Description)" with no success.

Suggest an answer

Log in or Sign up to answer