Skip to main content
1-Visitor
Feb 12, 2015 10:44 AM UTC
Solved

Get IssueId when creating issue from command line

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

    mrumpAnswer
    16-Pearl
    Feb 17, 2015 2:47 PM UTC

    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# >

    11 replies

    16-Pearl
    Feb 12, 2015 11:39 AM UTC

    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.

    Translate
    akuruvila1-VisitorAuthor
    1-Visitor
    Feb 13, 2015 8:51 AM UTC

    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

    Translate
    mrump16-PearlAnswer
    16-Pearl
    Feb 17, 2015 2:47 PM UTC

    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# >

    Translate
    1-Visitor
    Feb 25, 2015 1:58 PM UTC

    Hi Arun,

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

    HTH

    Thierry

    Translate
    akuruvila1-VisitorAuthor
    1-Visitor
    Feb 27, 2015 6:21 AM UTC

    Thanks for the reply Thierry.

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

    Regards,

    Arun

    Translate
    1-Visitor
    Feb 27, 2015 7:32 AM UTC

    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

    Translate
    1-Visitor
    Feb 27, 2015 8:06 AM UTC

    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

    Translate
    akuruvila1-VisitorAuthor
    1-Visitor
    Mar 4, 2015 6:08 AM UTC

    Still getting same issue.

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


    Regards,

    Arun

    Translate