This resource represents issue fields, both system and custom fields. Use it to get fields, field configurations, and create custom fields.

Hierarchy

  • CommonHttpService
    • IssueFieldsService

Constructors

  • Internal

    Create a new instance of the service.

    Parameters

    • getClientInstance: (() => CommonHttpClient)
        • (): CommonHttpClient
        • Returns CommonHttpClient

    Returns IssueFieldsService

Methods

  • Creates a custom field.

    Permissions required: Administer Jira global permission.

    Parameters

    Returns Promise<FieldDetails>

    Returned if the custom field is created.

    example:

    {
    "clauseNames": [
    "cf[10101]",
    "New custom field"
    ],
    "custom": true,
    "id": "customfield_10101",
    "key": "customfield_10101",
    "name": "New custom field",
    "navigable": true,
    "orderable": true,
    "schema": {
    "custom": "com.atlassian.jira.plugin.system.customfieldtypes:project",
    "customId": 10101,
    "type": "project"
    },
    "searchable": true,
    "untranslatedName": "New custom field"
    }

    POST /rest/api/3/field @scopes-current manage:jira-configuration @scopes-beta write:field:jira, read:avatar:jira, read:field:jira, read:project-category:jira, read:project:jira, read:field-configuration:jira

  • Returns system and custom issue fields according to the following rules:

    • Fields that cannot be added to the issue navigator are always returned.
    • Fields that cannot be placed on an issue screen are always returned.
    • Fields that depend on global Jira settings are only returned if the setting is enabled. That is, timetracking fields, subtasks, votes, and watches.
    • For all other fields, this operation only returns the fields that the user has permission to view (that is, the field is used in at least one project that the user has Browse Projects project permission for.)

    This operation can be accessed anonymously.

    Permissions required: None.

    Returns Promise<FieldDetails[]>

    Returned if the request is successful.

    example:

    [
    {
    "clauseNames": [
    "description"
    ],
    "custom": false,
    "id": "description",
    "name": "Description",
    "navigable": true,
    "orderable": true,
    "schema": {
    "system": "description",
    "type": "string"
    },
    "searchable": true
    },
    {
    "clauseNames": [
    "summary"
    ],
    "custom": false,
    "id": "summary",
    "key": "summary",
    "name": "Summary",
    "navigable": true,
    "orderable": true,
    "schema": {
    "system": "summary",
    "type": "string"
    },
    "searchable": true
    }
    ]

    GET /rest/api/3/field @scopes-current read:jira-work @scopes-beta read:field:jira, read:avatar:jira, read:project-category:jira, read:project:jira, read:field-configuration:jira

  • Returns a paginated list of fields for Classic Jira projects. The list can include:

    • all fields
    • specific fields, by defining id
    • fields that contain a string in the field name or description, by defining query
    • specific fields that contain a string in the field name or description, by defining id and query

    Use type must be set to custom to show custom fields only.

    Permissions required: Administer Jira global permission.

    Parameters

    • params: {
          expand?: string;
          id?: string[];
          maxResults?: number;
          orderBy?:
              | "name"
              | "contextsCount"
              | "lastUsed"
              | "projectsCount"
              | "screensCount"
              | "-name"
              | "+name"
              | "-contextsCount"
              | "+contextsCount"
              | "-lastUsed"
              | "+lastUsed"
              | "-screensCount"
              | "+screensCount"
              | "-projectsCount"
              | "+projectsCount";
          query?: string;
          startAt?: number;
          type?: ("custom" | "system")[];
      } = {}
      • Optionalexpand?: string

        Use expand to include additional information in the response. This parameter accepts a comma-separated list. Expand options include:

        • key returns the key for each field
        • stableId returns the stableId for each field
        • lastUsed returns the date when the value of the field last changed
        • screensCount returns the number of screens related to a field
        • contextsCount returns the number of contexts related to a field
        • isLocked returns information about whether the field is locked
        • searcherKey returns the searcher key for each custom field
      • Optionalid?: string[]

        The IDs of the custom fields to return or, where query is specified, filter.

      • OptionalmaxResults?: number

        The maximum number of items to return per page.

      • OptionalorderBy?:
            | "name"
            | "contextsCount"
            | "lastUsed"
            | "projectsCount"
            | "screensCount"
            | "-name"
            | "+name"
            | "-contextsCount"
            | "+contextsCount"
            | "-lastUsed"
            | "+lastUsed"
            | "-screensCount"
            | "+screensCount"
            | "-projectsCount"
            | "+projectsCount"

        Order the results by:

        • contextsCount sorts by the number of contexts related to a field
        • lastUsed sorts by the date when the value of the field last changed
        • name sorts by the field name
        • screensCount sorts by the number of screens related to a field
      • Optionalquery?: string

        String used to perform a case-insensitive partial match with field names or descriptions.

      • OptionalstartAt?: number

        The index of the first item to return in a page of results (page offset).

      • Optionaltype?: ("custom" | "system")[]

        The type of fields to search.

    Returns Promise<PageBeanField>

    Returned if the request is successful.

    example:

    {
    "isLast": false,
    "maxResults": 50,
    "startAt": 0,
    "total": 2,
    "values": [
    {
    "id": "customfield_10000",
    "name": "Approvers",
    "schema": {
    "custom": "com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker",
    "customId": 10000,
    "items": "user",
    "type": "array"
    },
    "description": "Contains users needed for approval. This custom field was created by Jira Service Desk.",
    "key": "customfield_10000",
    "stableId": "sfid:approvers",
    "isLocked": true,
    "searcherKey": "com.atlassian.jira.plugin.system.customfieldtypes:userpickergroupsearcher",
    "screensCount": 2,
    "contextsCount": 2,
    "lastUsed": {
    "type": "TRACKED",
    "value": "2021-01-28T07:37:40.000+0000"
    }
    },
    {
    "id": "customfield_10001",
    "name": "Change reason",
    "schema": {
    "custom": "com.atlassian.jira.plugin.system.customfieldtypes:select",
    "customId": 10001,
    "type": "option"
    },
    "description": "Choose the reason for the change request",
    "key": "customfield_10001",
    "stableId": "sfid:change-reason",
    "isLocked": false,
    "searcherKey": "com.atlassian.jira.plugin.system.customfieldtypes:multiselectsearcher",
    "screensCount": 2,
    "contextsCount": 2,
    "projectsCount": 2,
    "lastUsed": {
    "type": "NOT_TRACKED"
    }
    }
    ]
    }

    GET /rest/api/3/field/search @scopes-current read:jira-work @scopes-beta read:field:jira, read:field-configuration:jira

  • Returns a paginated list of fields in the trash. The list may be restricted to fields whose field name or description partially match a string.

    Only custom fields can be queried, type must be set to custom.

    Permissions required: Administer Jira global permission.

    Parameters

    • params: {
          expand?:
              | "name"
              | "projectsCount"
              | "-name"
              | "+name"
              | "-projectsCount"
              | "+projectsCount"
              | "trashDate"
              | "-trashDate"
              | "+trashDate"
              | "plannedDeletionDate"
              | "-plannedDeletionDate"
              | "+plannedDeletionDate";
          id?: string[];
          maxResults?: number;
          orderBy?: string;
          query?: string;
          startAt?: number;
      } = {}
      • Optionalexpand?:
            | "name"
            | "projectsCount"
            | "-name"
            | "+name"
            | "-projectsCount"
            | "+projectsCount"
            | "trashDate"
            | "-trashDate"
            | "+trashDate"
            | "plannedDeletionDate"
            | "-plannedDeletionDate"
            | "+plannedDeletionDate"
      • Optionalid?: string[]
      • OptionalmaxResults?: number

        The maximum number of items to return per page.

      • OptionalorderBy?: string

        Order the results by a field:

        • name sorts by the field name
        • trashDate sorts by the date the field was moved to the trash
        • plannedDeletionDate sorts by the planned deletion date
      • Optionalquery?: string

        String used to perform a case-insensitive partial match with field names or descriptions.

      • OptionalstartAt?: number

        The index of the first item to return in a page of results (page offset).

    Returns Promise<PageBeanField>

    Returned if the request is successful.

    example:

    {
    "isLast": false,
    "maxResults": 50,
    "startAt": 0,
    "total": 1,
    "values": [
    {
    "id": "customfield_10000",
    "name": "Approvers",
    "schema": {
    "custom": "com.atlassian.jira.plugin.system.customfieldtypes:multiuserpicker",
    "customId": 10003,
    "type": "array"
    },
    "description": "Contains users needed for approval. This custom field was created by Jira Service Desk.",
    "key": "customfield_10003",
    "trashedDate": "2022-10-06T07:32:47.000+0000",
    "trashedBy": {
    "accountId": "5b10a2844c20165700ede21g",
    "active": true,
    "avatarUrls": {
    "16x16": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=16&s=16",
    "24x24": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=24&s=24",
    "32x32": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=32&s=32",
    "48x48": "https://avatar-management--avatars.server-location.prod.public.atl-paas.net/initials/MK-5.png?size=48&s=48"
    },
    "displayName": "Mia Krystof",
    "emailAddress": "mia@example.com",
    "self": "https://your-domain.atlassian.net/rest/api/3/user?accountId=5b10a2844c20165700ede21g",
    "timeZone": "Australia/Sydney"
    },
    "plannedDeletionDate": "2022-10-24T07:32:47.000+0000"
    }
    ]
    }

    GET /rest/api/3/field/search/trashed @scopes-current read:jira-work @scopes-beta read:field:jira, read:field-configuration:jira, read:user:jira

  • Method to initialize the class. Normally used to set up validation rules.

    Returns void