Skip to main content
1-Visitor
February 12, 2015
Solved

Get IssueId when creating issue from command line

  • February 12, 2015
  • 3 replies
  • 6350 views

Hi Team,

I'm using batch file to create new issues ( im createissue) based on certain conditions. Is there any way i can get the ID of newly created item using the same batch file ?

Regards,

Arun

    Best answer by mrump

    Hi Arun,

    I am not sure whether using the --gui option gives you a result on the command line at all, as you'll get the visual feedback.

    Without the --gui option your command should result in something like:

    Modifying item ...

    Editing fields ...

    Submitting ...

    Updated item <# ITEM_ID# >

    3 replies

    16-Pearl
    February 12, 2015

    usually the new Item'S ID is the result value of a CLI "im createIssue .... " command.

    Depending on the Integrity Version you are using, this result is either streamed out on STDIO or STDERR.

    So you might have to check both and parse the result.

    akuruvila1-VisitorAuthor
    1-Visitor
    February 13, 2015

    Thanks for the reply Matthias.

    I was trying to capture STDIO / STDERR using below command - but got empty log file.Could you help.


    im editissue --Field='Description=%DESCRIPTION%' --gui %ITEM_ID% 1>D:/Integrity/log1.txt 2>&1

    **I'm able to get logs for viewissue commands.

    Regards,

    Arun

    mrump16-PearlAnswer
    16-Pearl
    February 17, 2015

    Hi Arun,

    I am not sure whether using the --gui option gives you a result on the command line at all, as you'll get the visual feedback.

    Without the --gui option your command should result in something like:

    Modifying item ...

    Editing fields ...

    Submitting ...

    Updated item <# ITEM_ID# >

    1-Visitor
    February 25, 2015

    Hi Arun,

    you can use the --xmlapi flag and parse their the command output to extract the IssueID.

    HTH

    Thierry

    akuruvila1-VisitorAuthor
    1-Visitor
    February 27, 2015

    Thanks for the reply Thierry.

    --xmlapi also not giving any output when used with --gui.

    Regards,

    Arun

    1-Visitor
    February 27, 2015

    Hi Arun

    ok. maybe it work for you to first to create the Issue without --gui and then open it with 'im editissue --gui IssueID'?

    or you want the possibility to cancel the issue creation?

    Regards

    Thierry

    1-Visitor
    February 27, 2015

    You could try the --displayIdOnly option. This has the effect you want of printing the ID of the newly created item. Using Korn you can do something like

    co2=$(im createissue --type="Change Order" <<fields>> --displayIdOnly 2>&1)

    print "Created Change Order issue $co2 and saved ID" >>deploy.log

    akuruvila1-VisitorAuthor
    1-Visitor
    March 4, 2015

    Still getting same issue.

    displayIdOnly not returning any value when used with --gui.


    Regards,

    Arun