Hello,
I'm trying to implement custom type issue using jira plugin.
what steps should be done for custom type issue to appear in "Create" form? (Like "Test" in Zephyr Add-on)
Any suggestions/examples would be highly appreciated.
Thanks!
@Egor Erofeev
You can create any number of issue type from JIRA Admin UI itself.
If you are trying to create issuetype through plugin code then you need to add the new custom issue type in the issuetype scheme for that particular project as well.
Only when the issue type is added to the issue type scheme of a project then only it will be visible in the drop down to Create issue.
Regards
Prakhar
Prakhar, thanks for your answer.
Actually I've succeeded to create an issue of Custom Type using plugin. Java class:
package com.....jira.plugins.jira.customissue;import com.atlassian.sal.api.ApplicationProperties;import javax.inject.Inject;import javax.inject.Named;import com.atlassian.jira.config.IssueTypeManager;import com.atlassian.jira.component.ComponentAccessor; public class NewCustomIssue{ private ApplicationProperties applicationProperties; @Inject public void MyPluginComponentImpl(ApplicationProperties applicationProperties){ IssueTypeManager itm = (IssueTypeManager) ComponentAccessor.getComponentOfType(IssueTypeManager.class); itm.createIssueType("Test", "Test", "https://jira.atlassian.com/images/atlassian-jira-logo-large.png");
Now my question is how to programmatically add this issue type to issue type of a project.
Hi @Egor Erofeev
Use the code below . You need to get the issueTypeScheme of your project and then update the scheme with a Collection of issue type ids.
Note : It will replace the current list with whatever you add here , so if you want to retain the old list also then you need to add those ids in the collection.
package com.....jira.plugins.jira.customissue;import com.atlassian.sal.api.ApplicationProperties;import javax.inject.Inject;import javax.inject.Named;import com.atlassian.jira.config.IssueTypeManager;import com.atlassian.jira.component.ComponentAccessor; public class NewCustomIssue{ private ApplicationProperties applicationProperties; @Inject public void MyPluginComponentImpl(ApplicationProperties applicationProperties){ ProjectManager projectManager = ComponentAccessor.getProjectManager(); Project project = projectManager.getProjectObjByKey("your-project-key"); IssueTypeManager itm = (IssueTypeManager) ComponentAccessor.getComponentOfType(IssueTypeManager.class); IssueTypeSchemeManager itsm = ComponentAccessor.getIssueTypeSchemeManager(); FieldConfigScheme issueTypeScheme = itsm.getConfigScheme(project); IssueType newIssueType = itm.createIssueType("Test", "Test", "https://jira.atlassian.com/images/atlassian-jira-logo-large.png"); Collection<String> options = new ArrayList<String>(); options.add(newIssueType.getId(); itsm.update(issueTypeScheme,options);
Thanks, Prakhar.
It worked for me.
It looks like you're new here. Sign in or register to get started.