cancel
Showing results for 
Search instead for 
Did you mean: 

JIRA Create Issue connector needs to support custom fields out-of-the-box

One of JIRA's main selling points is additional behavioral functionality via custom fields.  The current implementation of the JIRA connector does not support mandatory custom fields.  You can hack in field support by exporting the flow, adding the custom field definition, and re-importing the flow, however downstream modifications via the UI will clobber the underlying field definition and require you to repeat the process.

 

The UI will display a "fields" UI component if this hack is present so the underlying UI behavior for this already partially exists.  Please officially support this behavior under Advanced Configuration via an "Additional Fields" component and allow the user to specify custom field JSON.

 

Status: New
Comments
DavidSeager
New Member

I'm currently very keen to also have access to the Jira 'Component' so that adding specific metadata there would trigger an action (pushing details of that Jira item to Service Portal).

chegg_kboberg
New Member

For posterity, if you are running into this issue, here is the workaround:

 

When exporting your flow, you get a ZIP archive.  Extract the archive and navigate to <archive_folder_name>/Microsoft.Flow/flows/<guid>/definition.json.  Find the name of your JIRA flow step (spaces will be replaced by underscores).  The action type will be ApiConnection.  It will look something like this:

 

"New_Jira_Ticket": {
  "runAfter": {},
  "metadata": {
  "flowSystemMetadata": {
    "swaggerOperationId": "CreateIssue"
    }
  },
  "type": "ApiConnection",
  "inputs": {
    "host": {
      "connection": {
        "name": "@parameters('$connections')['shared_jira']['connectionId']"
      },
      "api": {
        "runtimeUrl": "https://flow-apim-msmanaged-na-centralus-01.azure-apim.net/apim/jira"
      }
    },
    "method": "post",
    "body": {
    "fields": {
      "issuetype": { "id": "10101" },
      "summary": "my issue summary",
      "description": "my issue description",
      "reporter": { "id": "********" },
      "priority": { "id": "1" },
      "labels": "some_label",
      "assignee": { "id": "***********" }
    }
  },
  "path": "/issue",
  "queries": { "projectKey": "KEY" },
  "authentication": "@parameters('$authentication')"
  }
}

 

Modify your "Body" argument to include your custom field identifier that needs to be set, e.g.: 

"fields": {
  "issuetype": { "id": "10101" },
  "summary": "my issue summary",
  "description": "my issue description",
  "reporter": { "id": "********" },
  "priority": { "id": "1" },
  "labels": "some_label",
  "assignee": { "id": "***********" },
  "customfield_11111" : {"value" : "No"}
}

 

Save definition.json.  Then, add the Microsoft.Flow folder and the manifest.json in the same directory to a new ZIP archive. This step is important, the zip you reupload must have the Microsoft.Flow folder and the accompanying manifest.json in the root of the archive.

Once you do this, the UI will display a "fields" text box in advanced settings.  You can use this to avoid doing the export trick by updating ALL of the fields for your issue in this field rather than setting them via the UI.  These will overwrite UI settings.. The fields must be provided as a JSON object like so:

 

{
  "issuetype": { "id": "10101" },
  "summary": "my issue summary",
  "description": "my issue description",
  "reporter": { "id": "********" },
  "priority": { "id": "1" },
  "labels": "some_label",
  "assignee": { "id": "***********" },
  "customfield_11111" : {"value" : "No"}
}

You will need to update the 'fields' text box with this JSON object every time you make a change to the flow.

 

Regarding custom fields that have text values, you are unfortunately venturing into Atlassian Document territory.  The documentation is here: https://developer.atlassian.com/cloud/jira/platform/apis/document/structure/.  If you are familiar with using an intercepting proxy such as Burp or Zap, capturing the API behavior of Jira when creating an issue via the UI can be very helpful when trying to create a modified field payload for the Power Automate connector.  Under the hood, it is making the following API call: https://developer.atlassian.com/cloud/jira/platform/rest/v3/#api-rest-api-3-issue-post

For text custom fields, the current (as of April 2020) Jira API (V3) request structure is as follows.

"customfield_40000": {
      "type": "doc",
      "version": 1,
      "content": [
        {
          "type": "paragraph",
          "content": [
            {
              "text": "Occurs on all orders",
              "type": "text"
            }
          ]
        }
      ]
    },