UI Kit components
Jira UI Kit components
UI Kit hooks
Forge bridge APIs
Jira bridge APIs
Upgrade UI Kit versions
Previous versions

CreateIssueModal

While custom fields and subtask issue type are not supported now, they may be added in the future.

The CreateIssueModal class enables your custom UI app to open an issue create modal pre-filled with data you supply.

Class signature

1
2
interface CreateIssueModalOptions {
  context?: {
    projectId?: string;
    issueTypeId?: string;
    parentId?: string;
    summary?: string;
    description?: Record<string, any>;
    environment?: Record<string, any>;
    assignee?: string;
    reporter?: string;
    labels?: string[];
    duedate?: string;
    priority?: string;
    components?: string[];
    versions?: string[];
    fixVersions?: string[];
  };
  onClose?: (args: {
    payload: {
      issueId: string;
    }[];
  }) => void;
}

class CreateIssueModal {
  constructor(opts?: CreateIssueModalOptions);
  open(): Promise<void>;
}

Arguments

  • onClose: A callback function that runs when the issue create modal is closed. The function is called with a list of the issues created.
  • context: Custom context that contains fields to pre-fill when the issue create modal opens.

The description and environment fields must be in an Atlassian Document Format.

Example

This example shows how to open an issue create modal with pre-filled fields.

1
2
import { CreateIssueModal } from '@forge/jira-bridge';

const createIssueModal = new CreateIssueModal({
  onClose: (payload) => {
    console.log('CreateIssueModal is closed with', payload);
  },
  context: {
    projectId: '10114',
    issueTypeId: '10004',
    parentId: '10152', // epic id
    summary: 'Issue summary',
    description: { version: 1, type: "doc", content: [] },
    environment: { version: 1, type: "doc", content: [] },
    assignee: '5cfa7fca3fa1890e7f17075e',
    reporter: '5cfa7fca3fa1890e7f17075e',
    labels: ['label-one', 'label-two'],
    duedate: '2022-02-28',
    priority: '2',
    components: ['10294', '10295'],
    versions: ['10039'],
    fixVersions: ['10039'],
  },
});

createIssueModal.open();

Rate this page: