Referencing Custom Issue Field to pass in as a Context Parameter Atlassian-Connect

353 views Asked by At

I'm trying to pass in the value of a jiraIssueField I define as a module into a webPanel item as a context parameter.

I've defined modules here:

I reference the custom field as addonkey__customfieldkey (separated by double underscore) in atlassian-connect.json

"modules": {
    "jiraIssueFields": [
      {
        "description": {
          "value": "Client email custom field"
        },
        "type": "string",
        "name": {
          "value": "Client Email"
        },
        "key": "email"
      }
    ],
    "webPanels": [
      {
        "key": "profile",
        "location": "atl.jira.view.issue.right.context",
        "name": {
          "value": "Profile"
        },
        "url": "/profile?clientEmail={addonkey__email}"
      }
    ]
  }

The value being passed is NULL though.

Is there anything I'm missing? Is there a prefix to reference custom fields in the URL for the webPanel?

Appreciate your help

1

There are 1 answers

0
Asjad Athick On

Update: Jira doesn't have the ability to pass in custom fields as context parameters.

The suggested way to get around the issue is to pass in the issue.key into the webPanel, and then poll the Jira REST API to get the value of the custom field. An extra API call and Auth requirements come in (making what I was trying to do a tad inconvenient).

"What I would recommend is you use the issue.id context parameter, like "url": "/profile/{issue.id}" and then make a client-side request for the field value from your add-on using AP.request to a URL like /rest/api/2/issue/{issue.id}?fields={addonkey__email}."

https://community.developer.atlassian.com/t/referencing-custom-issue-field-to-pass-in-as-a-context-parameter-atlassian-connect/6419/2

Hope this helps someone with the same problem!