Hello everyone.
I use createIssue() routine in my script. This routine gnneeds the issue type name as an input.
To make the script resistant to issue type renaming I'd like to put issue type id instaead of issue type name in it. I know how to find out the id, but do do not the convinient way to transform it to name
function getIssueTypeNameById(int issueID) {
string issueTypeName;
string query =
"SELECT \"PNAME\" FROM \"ISSUETYPE\" WHERE \"ID\" = " + issueID;
// runnerLog(query);
issueTypeName = sql("JiraDS", query);
if (iissueTypeName == "") {
issueTypeName = "not found";
}
return issueTypeName;
}
Hello @Ignat ,
I believe that you can use the id instead of the name when creating the parameters for the issue creation :
def issueFactory = ComponentAccessor.getIssueFactory()
def issueManager = ComponentAccessor.getIssueManager()
MutableIssue newIssue = issueFactory.getIssue()
newIssue.setRepoter(....
...)
newIssue.setIssueTypeId(12345)
Map<String,Object> newIssueParams = ["issue" : newIssue] as Map<String,Object>
issueManager.createIssueObject(user, newIssueParams)
Note that createIssueObject() should be better as it is not deprecated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to get the issue types of the project and then get the id Vaue
https://docs.atlassian.com/software/jira/docs/api/REST/7.11.0/#api/2/project-getProject
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.