How-to find the correct Form ID to perform actions on a form associated to an issue.

 

Platform Notice: Cloud - This article applies to Atlassian products on the cloud platform.

Summary

You would like to use Forms API to get/submit/reopen/delete a form from Jira Automation, third-party app, or any integration for an ISSUE

Environment

  • Jira Service Management Cloud

Diagnosis

When a new form is created in JSM via Project SettingsForms, an ID (identifier) will be created. However, when you associate this form with an issue, a new ID will be created for this association. A common error is to use the identifier from the Forms tab to get a form in an issue, and if you try that, the following error message will appear.

Request
https://api.atlassian.com/jira/forms/cloud/{cloudId}/issue/{issueIdOrKey}/form/{formId}
Response
{
  "errors": [
    {
      "status": 404,
      "code": "FORM_NOT_FOUND",
      "title": "Form Not Found",
      "detail": "The provided form ID was not found.",
      "context": [
        {
          "type": "issue",
          "id": "<IssueID>"
        },
        {
          "type": "form",
          "id": "<FormID>"
        }
      ]
    }
  ]
}

Solution

You need to get the correct form ID which was created when you associated the form with the issue.

How to get the correct form ID to update the form on the issue?

You need to get all the forms associated with the issue using the below request.

Request
https://api.atlassian.com/jira/forms/cloud/{cloudId}/issue/{issueIdOrKey}/form
Response
[
    {
        "id": "g4c5211b-0230-4d3e-aqw3-e29764377452",
        "formTemplate": {
            "id": "03h37dd0-r4a6-u798-hg41-3kid637fed40"
        },
        "internal": false,
        "submitted": true,
        "lock": false,
        "name": "<FormName>",
        "updated": "2023-06-20T18:53:48.348Z"
    }
]

So, for the current scenario, the ID that must be used to update a form associated with the issue is: "g4c5211b-0230-4d3e-aqw3-e29764377452". The ID inside of the "formTemplate" element "03h37dd0-r4a6-u798-hg41-3kid637fed40" is the global form ID. Using the following request, you would be able to perform any action on the form associated with the issue.

Request
https://api.atlassian.com/jira/forms/cloud/{cloudId}/issue/{issueIdOrKey}/form/g4c5211b-0230-4d3e-aqw3-e29764377452
Therefore, with the above instructions you will be able to use any action provided on the API Form documentation for Forms on Issue.

Last modified on Dec 4, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.