Confiforms - How to set multiple components from a Checkbox Group

Shawn P May 14, 2024

Hi All,

Can someone help me set multiple components in Jira via Confiform checkbox group?

Example:

I have a checkbox group with the following ID:Label Pairs

  • A:Apple
  • B:Banana
  • C:Cherry

Say the user selects both "Apple" and "Cherry" in the form.

I want both "A" and "C" to be added as components. I know you can set components in the JSON through the following:

{ "fields": { "components" : [{"name" : "A"}] }}

But how can I set up the JSON to loop through each selection in the checkbox group to add them to components?

 

 

 

1 answer

1 vote
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.
May 14, 2024

Hi @Shawn P 

You can use asArrayOfKVPairs function from https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

Assuming your field holding those options is named "myfield"

Then the expression would be

 { "fields": { "components" : [[entry.myfield.asArrayOfKVPairs(name)]] }}

Or if you want the label

{ "fields": { "components" : [[entry.myfield.transform(label).asArrayOfKVPairs(name)]] }}

Alex

Shawn P May 15, 2024

That did the trick, thanks Alex for the simple solution!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events