I have created a issue of type 'Bug'.
I am able to get this issue(eg: MYP-1 is an id for the issue)
Now, how to get the Bug id (i.e type id) using MYP-1
issue.getIssueTypeObject().getId()
You don't say where you are doing this. Assuming it's in code, then look at the issue object.
The id of issue type "Bug" or the id of issue "MYP-1"?
I need the id for "Bug"
In Creating the subtask automatically when an issue is created
see this
https://confluence.atlassian.com/display/JIRA/Finding+the+Id+for+Issue+Types
I need the id for "Bug" using "MYP-1"
I think you are trying to check if the issuetype is a BUG, right ?
Sorry, that's not what I meant. We don't know what you are doing with "creating the subtask". If you've got the issue id, then you should have, or be able to get, an issue object, and then read that for more information (including type - where Conrad's answer is what you need to look at)
This I tried as follow
if(parentIssue.getIssueTypeObject().getId()==1)
but not working
You really do need to think through your code. The line above IS working fine, but it's not doing what you expect.
Try looking at what it is actually returning - that should tell you more. For example, is id 1 really Bug? Are you looking at the right issue and is it definitely a Bug?
(If it's a sub-task, I really do think you'll find it is NOT a bug, but I don't have access to your system to check that instinct)
It looks like you're new here. Sign in or register to get started.