Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to retrieve the values ​​of a multi select dropdown linked with a data connection in the APIs?

Nicolas Gagnaire
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 28, 2023

Hello,

I would like to retrieve the values ​​of a multi select dropdown linked with a data connection in the automation.

Capture d’écran 2023-06-28 à 09.25.14.png 

Indeed I would like to retrieve the values ​​entered in this particular field in the form. I looked for the RDFDRIVERS-VERSIONS field (name of my data connection) but also the Field key and a lot of customs fields in the json of the ticket without success.

Once recovered I would like to fill in a field in a new ticket for another project.

 

Thanks

Regards

Nicolas

 

1 answer

0 votes
Rudy Holtkamp
Community Champion
July 3, 2023

Hi @Nicolas Gagnaire ,

It is a bit complicated, but it can be achieved. First I would like you to take a look at this page to get a bit of background knowledge of how to retrieve form values.

Now submit a form and for your affected version field, choose a value from the list provided. It does not matter which one, as long as your remember it. (E.g. the issue you created is called RDF-1)

Now open a new tab in your browser and go to https://<yoursite>.atlassian.net/rest/api/latest/issue/RDF-1/properties/proforma.forms.i1

(if you haven't, use chrome and install the extension JSON formatter. Or a similar formatter for another browser).

Now you will see a JSON. Search for 'Versions affectées'. You will see something like this:

"questions": {
"1": {
"type": "cd",
"label": "Soort kosten",
"description": "",
"validation": {
"rq": true
},
"choices": [
{
"id": "1",
"label": "Kilometervergoeding",
"other": false
},{
"id": "5",
"label": "Maaltijden en consumpties",
"other": false
},{
"id": "2",
"label": "Representatiekosten",
"other": false
},{
"id": "3",
"label": "Reis/verblijfkosten",
"other": false
},
],
"questionKey": ""
},

 Your search will match with the label, make sure you are in the 'questions' section of the JSON.

Now remember the number of the question. In the example above it is '1'.

Now you need to search for 'answers' and look for '1'.

"state": {
"visibility": "e",
"status": "s",
"answers": {
"1": {
"text": "",
"choices": [
"1"
]
},

Here you see that the answer for question '1' is choice '1' . If you take a look at the question again, you see that this corresponds with label "Kilometervergoeding".

In your case you probably see the text of the choice already.

Which means that your smart values will look like this:

{{issue.properties."proforma.forms.i1".state.answers.1.choices.get(0)}}
{{issue.properties."proforma.forms.i1".state.answers.1.choices.get(1)}}
{{issue.properties."proforma.forms.i1".state.answers.1.choices.get(2)}}
{{issue.properties."proforma.forms.i1".state.answers.1.choices.get(3)}}
{{issue.properties."proforma.forms.i1".state.answers.1.choices.get(4)}}

I've posted the above in 5 fold because you can have 5 values. Where the answers.1.choices, should be replaced with the question number you have.

You should use this in an automation rule to set the field in the other project. Before doing so, you should test if the value is empty or not.

I hope this helps.

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
TAGS
AUG Leaders

Atlassian Community Events