Forums

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

Concat fields from Confiforms over to Components in JIRA

Vivek Dokania April 25, 2019

Hi Atlassian Community, 

 

I am a novice with coding and I have created my first ever form with Confiforms. 

I need help with two things - 

1. I want to map the multi-select field from confluence using confiforms (i.e. user inputs) over to Labels in JIRA. 

For example: User selects ("Apple", "Grapes", "Oranges") in the multi-select field in the confiform and this should be created as Labels in JIRA as individual element. (Just to let you know the elements in the multi-select field doesnt have any spaces).

 

2. There are two fields in confiforms, Field1 (a single dropdown) and Field2(a single dropdown). I want to concat the user selection in the confiform as Field1 + Field2.

 

For example - Field1 has values (1. Anne, 2. Bob, 3. Charlie) and Field2 has values (1. X, 2. Y, 3. Z). If the user selects "Anne" in first field and "Z" in second field, then the output of "Anne_Z" should be going into the Components field in JIRA. 

 

Any help with the JSON code would be really really helpful. 

Thanks

2 answers

2 votes
Alex Medved _ConfiForms_
Community Champion
April 26, 2019

To answer 1st part of your question:

 

For the components you will need to have a structure like this, in your JSON

"components": [{"name":"XXXX"},{"name":"YYYY}]

From ConfiForms, when mapping your multi-value field in the JSON you will need to use the virtual function called "asArrayOfKVPairs(name)"

https://wiki.vertuna.com/display/CONFIFORMS/Virtual+functions

Basically to have something like

"components": [[entry.your_field_here.asArrayOfKVPairs(name)]]

where "your_field_here" is the name of the multi-value field you want to map as your components

Vivek Dokania April 26, 2019

Hi Alex, 

Thanks a ton for sharing this. 

The above notation helped me in resolving Issue 2.

But I am still having troubles with Issue 1. 

Everytime, I try that I get the following error - 

"errors":{"labels":"The label 'Apple Grapes' contains spaces which is invalid."}

Just that you know that if I go into JIRA and type Apple then ENTER then Grapes, it works for me and it creates two separate Labels in JIRA as Apple and Grapes (pic attached)Labels in JIRA.PNG

Alex Medved _ConfiForms_
Community Champion
April 26, 2019

How do you map the labels field in Jira JSON and what type of the field is used in ConfiForms?

Vivek Dokania April 26, 2019

Using the JSON code provided by you above. 

"labels": [[entry.Platform.asArrayOfKVPairs(name)]]

the field in the confiform is a Multi-Select field. 

Users can select more than one element in the box. The elements are shown up as TILE in the field. 

Alex Medved _ConfiForms_
Community Champion
April 26, 2019

The example was for components field. Labels field in Jira is expected in a different format

 "labels": [
"Apple",
"GRAPES"
]

So, the mapping needs to be different

"labels" : [[entry.Platform.transform(label).asArray]]

if you want to send the label form your multi-select field, if you want to set IDs then 

"labels" : [[entry.Platform.transform(id).asArray]]

or

"labels" : [[entry.Platform.asArray]]
Like # people like this
Vivek Dokania April 26, 2019

You are a genius... 

All i used your code.. just a slight edit - 

"labels" : [[entry.Platform.asArray(')]]

and it worked like a charm... 

 

Thanks a lot ALEX... really appreciate your help. 

Vivek Dokania April 29, 2019

Hi Alex, 

You have helped me previously and I need your help again now. 

With your help I have successfully created my form. 

Now, I am trying to have an IFTTT rule in the form, where the form would create a JIRA issue only when the form is APPROVED (i.e. Success)

For the Approval I have used the field type "Status - group your data". 

So once the Approver, selects "APPROVED", I want to create an Issue in JIRA. 

I have succeeded in creating JIRA issue without this condition. That being said, when the user submits the change, a JIRA issue is created. 

 

But it fails, when I add the rule in the IFTTT as - entry.Status:success 

Please help. 

 

Thanks in advance.

Vivek Dokania April 29, 2019

Hi Alex, 

I got it working... All i need to do is to change the IFTTT to on Modified. 

Thanks a lot

Alex Medved _ConfiForms_
Community Champion
April 30, 2019

You need to set the filter to track the change

Your condition for IFTTT shall be something like

hasChanged(Status):true AND Status:success

See more about hasChanged function in our docs 

Vivek Dokania May 27, 2019

Hi Alex, 

 

I am trying to Clone JIRA tickets (based on the user input of the existing JIRA ticket). 

Right now, I have already created the Confiform to create a New JIRA ticket, but now I want to use the Update JIRA ticket and want to link it to the existing JIRA ticket. 

 

Is it something we can do using Confiforms?

Let's say Confiform created new JIRA # "AB-1540"

This Issue = duplicate

Issue = "AB-1112" (Existing JIRA ticket. It would be a field in Confirform to be filled by users)

Comment = "aaaaa"

Clone.jpg

Alex Medved _ConfiForms_
Community Champion
May 27, 2019

Yes, you can link issues with ConfiForms, basically with Jira REST API, for the documentation see https://developer.atlassian.com/server/jira/platform/jira-rest-api-example-edit-issues-6291632/

 

ConfiForms only calls the create/update Jira REST API with what you tell it to use (JSON). and it is a matter of creating a proper JSON document for Jira API

Also, you can call ANY API with AppLink Service action in ConfiForms IFTTT - create/update Jira issue actions are just the "predefined" calls over the generic AppLink Service action

Vivek Dokania May 28, 2019

Thanks a lot Alex... I would look into that.. really appreciate your inputs.

0 votes
Tanmay Gadkari
Contributor
February 10, 2022

Hi @Alex Medved _ConfiForms_  @Vivek Dokania 

I'm facing a similar issue that you guys resolved a couple of years ago. Hoping you can help. 

I am trying to populate the Components field in my jira using a Confiforms that has a dropdown for my Infrastructure Component values... Here's one of the 100 different options i tried (final one based on comments above): 

"components": [[entry.infracomponent.asArrayOfKVPairs(name)]],

 

I keep getting the expected an object error all the time. 

Any help here would be appreciated.    

Alex Medved _ConfiForms_
Community Champion
February 10, 2022

If your field is a (single choice) dropdown then you can just have something like

"components":[{"name":"[entry.infracomponent.label]"}]
Like Tanmay Gadkari likes this
Tanmay Gadkari
Contributor
February 24, 2022

I'm pathetic when it comes to responding here soon enough. This worked brilliantly. Thanks so much @Alex Medved _ConfiForms_ ! Perfect solution as always.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events