Unable to interpret the type(whether is a dropdown, checkbox, multiselect etc) of a field from the create issue metadata response

Hi,
I am working on react app in which I would like to allow user to Create Issue in jira from the react app(one of the feature).

I could’nt find any libraries which provides a widget similar to create issue dialog in jira.

so thought of creating a dynamic UI for the same which contains all the fields and functionalities as in Create issue dialog of Jira.

To get all the available field’s information, I used this API: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-createmeta-get

But the field details returned in the response isn’t sufficient to dynamically create the UI.

If there is a ui hint in the response, which says a particular field is a dropdown or datepicker or so, it would be useful from UI perspective.

So is there a way to figure out what is the type of a field ?

example: issuetype(in create issue dialog) is a dropdown, but in the API response, type for issuetype field is received as {“type”: “issuetype”}. But i want to interpret that the issuetype field is a dropdown.

any help in this regard is appreciated :slight_smile:

Thank you

:wave: @Riyaz_CG and welcome to the Atlassian Developer community!

I don’t have the full answer to your question, but let me share a few more details.

Many devs found this post by Beata useful to retrieve the fields available in the UI: Get all fields and choices for a single project (classic or nextgen) - #3 by BeataSzturemska

Regarding the issue types field specifically, once I’ve retrieved the field id using the /rest/api/3/field endpoint, I’ve requested the /rest/api/3/issuetype one to retrieve the details of all the available issue types. This will not work with every field but it’s a start.
The output will look something like this:

    "self": "https://<yoursite>.atlassian.net/rest/api/3/issuetype/10004",
    "id": "10004",
    "description": "A problem or error.",
    "iconUrl": "https://<yoursite>.atlassian.net/secure/viewavatar?size=medium&avatarId=10303&avatarType=issuetype",
    "name": "Bug",
    "untranslatedName": "Bug",
    "subtask": false,
    "avatarId": 10303,
    "hierarchyLevel": 0
},
{
    "self": "https://<yoursite>.atlassian.net/rest/api/3/issuetype/10002",
    "id": "10002",
    "description": "A small, distinct piece of work.",
    "iconUrl": "https://<yoursite>.atlassian.net/secure/viewavatar?size=medium&avatarId=10318&avatarType=issuetype",
    "name": "Task",
    "untranslatedName": "Task",
    "subtask": false,
    "avatarId": 10318,
    "hierarchyLevel": 0
}

Let us know how you go,
Caterina

Hi @ccurti :wave:
Thank you for the details provided.
I went through the responses returned by the APIs whichever is mentioned above.
I see that no api provides me the information which i need.

I want to do something like:

switch(jiraUiElementType) {
case ‘textbox’:
return textbox element
case ‘checkbox’:
return checkbox element
case ‘multiSelectableDropdown’:
return MultiSelectDropdown element
}

From jira APIs i want to know which field is a textbox, checkbox, multiSelectableDropdown etc.

As a solution, By observing the standard fields from Jira i can prepare the list of fields and Ui types.
But in case of custom fields this approach will become problematic again.

I tried using direct html link to “create defect form” inside iframe,
But design customization and some event handling(to recognise create and cancel button click) will not possible in this case.

I don’t think I know of any other option @Riyaz_CG (also great job in following up and testing this) but maybe somebody else here does.

One question for you: will the app be installed in Jira? Or is the for outside of Jira?

I’m asking because if it’s in Jira, you could see if any of the existing apps would help (this is the most relevant thread that I could find with links to existing apps: https://community.atlassian.com/t5/Jira-questions/How-to-create-a-Request-form/qaq-p/125717) or you could try ProForma: Forms & Checklist for Jira | Atlassian Marketplace which is an addon provided by Atlassian.

app will be installed outside jira.
For the time being i would create a JSON with fields and its jira UI types (By referring the jira create issue form). Once I come across a appropriate solution, i would refactor the approach.
Thanks for the help @ccurti :grinning: