[Confiforms] Webservice rest api with multiselect field

Xavier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 10, 2018

Dear all,

In a Confluence page, using Confiforms, I try to use "consume" a DB dropdown multiselect values field (cst16000) to a WebService using Rest API Jira (to create a Jira ticket with provide data from my page).

The need is to push all values from this dropdown to the Insight Object Custom Field (customfield_16000) of Jira ticket I want to create.

It works well, except when I select multiple values on my dropdown.

 

On my IFTTT integration rules, I add a 'No format' block, with this kind of data (below code runs when select only one value)

 

{
    "fields": {
       "project": {
          "key": "XXX"
       },
	   "reporter" : {
			"name":"[user.name]"
		},
	   "summary":             "[entry.summary.escapeJSON]",
           "description":         "[entry.desc1.escapeJSON]",
	   "customfield_16000" :  [{"key": "[entry.cst16000.id]"}],
	   "issuetype": {
          "name": "YYYY"
       }
   }
}

 

Manually, I can populate multiple values like this:

"customfield_16000" : [{"key": "KEY1"}, {"key": "KEY2"}],

 

How I can have all my values under an array ?

 

In other way, I try to use a Insight Object field type (runs as I can select only one value). But when trying to use an "Insight object (multiselect)", I have no the option to select the Object Type (as proposed with "Insight Object dropdown." So what is the difference between those two kind of fields ?

How I can use Insight Object (multiselect) with the rest api to have the same result ?

 

thanks in advance.

Regards

1 answer

1 accepted

2 votes
Answer accepted
Xavier
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2018

I finally found using virtual function:

 

[[entry.cst16000.transform(id).asArrayOfKVPairs(key)]]

 

reagrds

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
December 11, 2018

ConfiForms has a bunch on "virtual functions" you can apply on the data to transform it the way you need, the full list could be found here - ConfiForms virtual functions

Sana Safai
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 19, 2022

Just wanted to add that I changed id to objectKey to make it work. In your example it would be:

[[entry.cst16000.transform(objectKey).asArrayOfKVPairs(key)]]
SPadalkar October 2, 2024

Hi @Alex Medved _ConfiForms_ ,

 

You have helped me with this before where

"customfield_30984": [[entry.FArea.asArrayOfKVPairs(value)]],

worked in the past. This was paired with the dropdown (FArea) that was using Webservice Dynamic Multi label and the dropdown list was populated via an excel attachment. The connection to the attachment breaks and dropdowns appear empty every so often. 

So I am trying to switch to a Jira API to get the list of options.  From the same Jira project where I am ultimately creating tickets. I switched the dropdown to Webservice Multi Select and loading the options using the following Jira rest API. The dropdown is showing the list of options successfully. 

/rest/api/2/issue/createmeta/<project>/issuetypes/9?expand=projects.issuetypes.fields

 

But while building the Jira payload, the following combos are failing.

[[entry.FArea.asArrayOfKVPairs(value)]],

[[entry.FArea.transform(id).asArrayOfKVPairs(value)]]

[[entry.FArea.transform(objectKey).asArrayOfKVPairs(value)]]

[entry.FArea.transform(id).asArrayMultiSelect()]


I am looking to convert the selection to this format

[{"value": "value1"}, {"value": "value2"}]

 

Appreciate your help.

SPadalkar October 2, 2024

This worked. :) 

[[entry.FArea.transform(value).asArrayOfKVPairs(value)]]

Alex Medved _ConfiForms_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 2, 2024

There is really not much to guess... How the field is configured (all details)? 

Also, have not you tried to figure out why the reading from excel does not work for you? Could it be a permissions issue or it does not work at random? 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events