Create project template with issue type screen scheme

Hello,

I’m working on a corporate plugin to create project templates (following the tutorial https://developer.atlassian.com/server/jira/platform/creating-a-project-template/)\\ )

It works well but I need to go further :grin:

I would like to setup the JSON configuration file with issue type screen scheme and screen schemes. I see on java documentation some methods and interfaces to implement these schemes (https://docs.atlassian.com/software/jira/docs/api/7.5.0/com/atlassian/jira/project/template/hook/package-summary.html\) but I don’t find any examples of JSON with these schemes.

Could you help me and maybe provide an example of complete JSON to instanciate a JIRA Project with all of these schemes ?

Regards,

Baptiste

4 Likes

A complete example from one of mine:

{
  "issue-type-scheme":
  {
    "name": "Task Tracking Issue Type Scheme",
    "description": "A collection of Issue Types for tracking projects and tasks.",
    "default-issue-type": "taskType",
    "issue-types": [
      {
        "key": "epicType",
        "name": "Epic",
        "description": "A big user story that needs to be broken down.",
        "avatar": "/images/svg/epic.svg",
        "icon": "/images/png/epic.png",
        "screen-scheme":"epicDefaultScreenScheme"
      },
      {
        "key": "taskType",
        "name": "Task",
        "description": "A task that needs to be done.",
        "avatar": "/images/svg/task.svg",
        "icon": "/images/png/task.png"
      },
      {
        "key": "subtaskType",
        "name": "Sub-Task",
        "description": "A sub-task of the issue.",
        "avatar": "/images/svg/subtask.svg",
        "icon": "/images/png/subtask.png",
        "screen-scheme":"subtaskDefaultScreenScheme",
        "sub-task": true,
        "workflow": "simpleWorkflow"
      }
    ]
  },
  "workflow-scheme":
  {
    "name": "Standard Task Workflow Scheme",
    "description": "A collection of Workflows assigned to Issue Types, used in projects for tracking projects and tasks.",
    "default-workflow": "taskWorkflow",
    "workflows": [
      {
        "key": "taskWorkflow",
        "name": "Standard Task Workflow",
        "description": "Basic 3-step workflow for JIRA new project creation blueprint.",
        "workflow-bundle": "/workflows/Standard-Task-Workflow-1.1.jwb"
      },
      {
        "key": "simpleWorkflow",
        "name": "Standard Simple Workflow",
        "description": "Basic 2-step workflow for JIRA new project creation blueprint.",
        "workflow-bundle": "/workflows/Standard-Simple-Workflow-1.1.jwb"
      }
    ]
  },
  "issue-type-screen-scheme":
  {
    "name": "Task Tracking Issue Type Screen Scheme",
    "description": "A collection of tabs and fields, used for tracking Tasks and Projects.",
    "default-screen-scheme": "taskDefaultScreenScheme",
    "screens": [
      {
        "key": "taskDefaultScreen",
        "name": "Task Tracking Default Screen",
        "tabs": [
          {
            "name": "Field Tab",
            "fields":[
              "issuetype",
              "summary",
              "description",
              "attachment",
              "security",
              "components",
              "priority",
              "duedate",
              "reporter",
              "assignee",
              "labels"
            ]
          }
        ]
      },{
        "key": "epicDefaultScreen",
        "name": "Task Tracking Epic Screen",
        "tabs": [
          {
            "name": "Field Tab",
            "fields":[
              "summary",
              "description",
              "attachment",
              "security",
              "components",
              "priority",
              "duedate",
              "reporter",
              "assignee",
              "labels"
            ]
          }
        ]
      },{
        "key": "subtaskDefaultScreen",
        "name": "Task Tracking Subtask Screen",
        "tabs": [
          {
            "name": "Field Tab",
            "fields":[
              "summary",
              "description",
              "attachment",
              "security",
              "components",
              "priority",
              "duedate",
              "reporter",
              "assignee",
              "labels"
            ]
          }
        ]
      }
    ],
    "screen-schemes": [
      {
        "key": "taskDefaultScreenScheme",
        "name": "Task Tracking Default Screen Scheme",
        "default-screen": "taskDefaultScreen"
      },{
        "key": "epicDefaultScreenScheme",
        "name": "Task Tracking Epic Screen Scheme",
        "default-screen": "epicDefaultScreen"
      },{
        "key": "subtaskDefaultScreenScheme",
        "name": "Task Tracking Subtask Screen Scheme",
        "default-screen": "subtaskDefaultScreen"
      }
    ]
  }
}
1 Like

Thank you for your reply. Exactly what I was searching for!

Do you have some other examples of JSON code to add on this template (custom fields, field layout…) ? I saw on documentation interfaces about Resolution. Have you got an idea of how it works ?

1 Like

Can you tell me specifically what you’re trying to accomplish?

I have the same requirements, I am creating a project template with custom workflow, custom fields and custom screens. How can I create custom fields using project-template json?

1 Like

Did you get any solution to create a custom field in project template?

Hello,

I did not find a solution to create custom fields using the JSON template :cry:

(The custom field “Area” is pre-existing on the instance) Here is what I’ve tried so far:

{
        "key": "customScreen",
	"name": "Custom Screen",
	"description": "custom screen description",
				"tabs": [
					{
						"name": "General",
						"fields": [
							"issuetype",
							"summary",
							"reporter",
							"assignee",												
						],
						"custom-fields": [
							"Area"
						]
					}
{
        "key": "customScreen",
	"name": "Custom Screen",
	"description": "custom screen description",
				"tabs": [
					{
						"name": "General",
						"fields": [
							"issuetype",
							"summary",
							"reporter",
							"assignee",
							"Area"					
						]
					}

and both these tests with “Area” in uppercase and lowercase.
It doesn’t work and I can’t find any error in the logs.

@sfbehnke do you maybe have advice?

Thanks in advance!

You can’t use the JSON Config afaik. You must write java code in the projectHook.

Hello, I have 2 questions:

1.) How to associate screens with specific operations like Create, Edit and Delete?
2.) How to associate all of my screens with a screen scheme?

Thanks!!

Please just address the source code. The JSON Import interface supports very specific things only. Everything else is addressed through a Java Class called after the project is created.

The relevant JSON Serializer is located in com.atlassian.jira.project.template.hook.ConfigTemplateImpl.

Just in case someone stumbles upon this looking for answer (I myself hate spending time googling only to find an unanswered question :slight_smile:)

Associating screens with operations is simple, just add the required screen into the screen scheme definition (havent tested, but I believe there is no Delete action, the JIRA only allows you to set screens for Create, Edit and View actions)

"screen-schemes": [
      {
        "key": "defaultScreenScheme",
        "name": "Software Development Default Screen Scheme",
        "default-screen": "defaultChangeRequestScreen"
      },
      {
        "key": "changeRequestScreenScheme",
        "name": "Software Development Change Request Screen Scheme",
        "default-screen": "defaultChangeRequestScreen",
        "create-screen": "createChangeRequestScreen",
        "edit-screen": "editChangeRequestScreen"
      }
    ]