In this tutorial we show how to fill in the dropdown field with values for priorities (priority field in JIRA project)
The underlying request is as follows
With response given with the following structure:
Expand | ||
---|---|---|
|
Info |
---|
If you are looking to build a similar thing using Jira 9 then have a look at this page as well - Navigating through JSON properties |
We show priorities for issue type "Task" (first one in the response)
ConfiForms Form Definition | ||
---|---|---|
| ||
It is important to undertand the structre of the response in order to understand how the dropdown field is built / mapped
Source code for the form
Code Block |
---|
<ac:structured-macro ac:macro-id="45065969-9928-4af4-8926-cd18076a7db9" ac:name="confiform" ac:schema-version="1">
<ac:parameter ac:name="formName">f1</ac:parameter>
<ac:rich-text-body>
<ac:structured-macro ac:macro-id="972e30b8-5709-454c-a3d6-e93bc5f6e7eb" ac:name="confiform-entry-register" ac:schema-version="1">
<ac:parameter ac:name="embedded">true</ac:parameter>
<ac:parameter ac:name="atlassian-macro-output-type">INLINE</ac:parameter>
<ac:rich-text-body>
<p>
<br/>
</p>
</ac:rich-text-body>
</ac:structured-macro>
<p>
<ac:structured-macro ac:macro-id="80dec9d6-432b-4f0f-b2bb-22cec7b7f209" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="mapping">projects[1].issuetypes[0].fields.priority.allowedValues|id|name</ac:parameter>
<ac:parameter ac:name="fieldName">choices</ac:parameter>
<ac:parameter ac:name="fieldLabel">choices from jira field</ac:parameter>
<ac:parameter ac:name="values">/rest/api/latest/issue/createmeta?expand=projects.issuetypes.fields&projectKeys=JTEST</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="type">wsselect</ac:parameter>
</ac:structured-macro>
</p>
<p>
<ac:structured-macro ac:macro-id="7c654cc6-804f-41c2-a33c-981af412b647" ac:name="confiform-field-definition" ac:schema-version="1">
<ac:parameter ac:name="mapping">projects[1].issuetypes[0].fields.customfield_10216.allowedValues|id|value</ac:parameter>
<ac:parameter ac:name="fieldName">somecustomfield</ac:parameter>
<ac:parameter ac:name="fieldLabel">custom field</ac:parameter>
<ac:parameter ac:name="values">/rest/api/latest/issue/createmeta?expand=projects.issuetypes.fields&projectKeys=JTEST</ac:parameter>
<ac:parameter ac:name="extras">4bb4c41a51f289a07507d50a1b841a4d</ac:parameter>
<ac:parameter ac:name="type">wsselect</ac:parameter>
</ac:structured-macro>
</p>
</ac:rich-text-body>
</ac:structured-macro> |
So, we take the response, and go through projects, selecting 2nd element from the array, then take issuetypes field and get the 1st element, then going down the tree to "fields", then finding "priority" field and it's "allowedValues"
Code Block |
---|
projects[1].issuetypes[0].fields.priority.allowedValues |
Warning | ||||
---|---|---|---|---|
If you are using latest createmeta APIs from Jira 9
The root to use parameter value will be a bit different. An expression would look like this (to get values for the priority field)
Mappings for the ID and LABEL (parameters) will be the same: id and name |
Info |
---|
Our web service connection to set to "https://vertuna-test.atlassian.net" |