4

I've been trying to figure out how to create a custom field in my Jira Plugin by using the Atlassian SDK, but I'm running into a couple of issues while wondering though the documentation and docs. Currently, I am able to create a custom field with the following code:

CustomField fieldType = customFieldManager.getCustomFieldObjectByName("Type of Work");
    CustomFieldSearcher fieldTypeSearcher = customFieldManager.getCustomFieldSearcher("com.atlassian.jira.plugin.system.customfieldtypes:select");
    if(fieldType == null) {
        List<String> issueTypes = new ArrayList<String>();
        issueTypes.add("Story");

        List<String> contextTypes = new ArrayList<String>();
        //contextTypes.add(GlobalIssueContext.GLOBAL_CONTEXT_STR);
        contextTypes.add("Global");

        /*Collection<IssueType> list = constantsManager.getAllIssueTypeObjects();
        for(IssueType issueType : list) {
            if(issueType.getName().equals("Story")) {
                issueTypes.add(issueType);
            }
        }*/

        /*if(issueTypes.size() == 0)
            throw new Exception("Greenhopper must be installed!");*/

        CustomFieldType selectFieldType = customFieldManager.getCustomFieldType("com.atlassian.jira.plugin.system.customfieldtypes:select");
        try {
            CustomField typeOfWorkField = customFieldManager.createCustomField("Type of Work", "Used to track a stories type of work", selectFieldType, fieldTypeSearcher, contextTypes, issueTypes);
            //typeOfWorkField.
        } catch (GenericEntityException e) {
            writeMe += e.toString();
        }
    }

My issue lies in setting the customFields context and issueTypes. I want it to work in the global context and in greenhoppers Story Issue. Can anyone help out? Also, once I get that setup, I would like to set up the default screen. Any ideas?

1 Answer 1

2

Found the solution to my problem here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.