Forums

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

Link Component dropdwon value with Team Name

Deva October 13, 2022

Hi, 

I am a novice with coding and I'm trying to create a confiforms, with these options. 

I need help with two things 

first one :

Component drodown contains Value1, Value2, Value3

I have 4 Teams in Jira, Team A, Team B, Team C & Team D

if user selects Component Value1 then it should automatically map to Team A

similarly if user selects Value 2 then map to Team B 

if user selects Value 3 then it should map to Team C & Team D

OnCreated Jira ticket i should get a ticket with (1). Value1 - Team A (2). Value2 - Team B (3). Value B - Team C & Team D

Second one: 

2. on selecting anything from dropdown Value1/value2/value3 it should display another confiforms page 

 

 

1 answer

1 accepted

0 votes
Answer accepted
Alex Medved _ConfiForms_
Community Champion
October 13, 2022

Hi

You can set up rules that set the values in a field based on the selection being made in another field https://wiki.vertuna.com/display/CONFIFORMS/ConfiForms+Field+Definition+Rules#ConfiFormsFieldDefinitionRules-Setvalue

Or have a similar logic inside the IFTTT macro by using Velocity instructions #if()#end

https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-CreateJiraIssue

Alex

Deva October 31, 2022

Thanks Alex. can you please give some sample code/procedure to create Jira issue when one of the components selected from dropdown.  

only one selected component should be linked to the created jira ticket

Screen Shot 2022-10-31 at 4.12.40 PM.png

Alex Medved _ConfiForms_
Community Champion
October 31, 2022

Hi

Not sure how your field in ConfiForms is called but the structure in JSON mapping for components in JIRA REST APIs is 

"components": [{
  "name": "someComponent"
}],

Change someComponent to a reference of ConfiForms field [entry.field_name.label]

(where field_name) is the name of your components field in ConfiForms

Alex

Like Deva likes this
Deva October 31, 2022

Thanks Alex. it worked. 

Alex Medved _ConfiForms_
Community Champion
October 31, 2022

Glad to hear

Accept the answer then;)

Deva November 3, 2022

Alex, need one more support.

I want to assign Team when user selects component. 

if user selects Microservices-Infra Component then "Team A" should be assigned 

similarly if component is Security Testing then "Team B" should be assigned

 

could you plz share procedure to do this 

Alex Medved _ConfiForms_
Community Champion
November 3, 2022

What do you mean by “assigning”

Assigned where? To some jira field?

Deva November 3, 2022

yes, its jira field. with component i'm creating Jira ticket but need to assign relevant Team to the ticket.  Screen Shot 2022-11-04 at 1.32.55 AM.png

Alex Medved _ConfiForms_
Community Champion
November 3, 2022

It is really in the documentation.. you can use Velocity templating 

#set($comp = "[entry.Component]")
#if($comp == 'A')
"customfield_XXX": "Team A",
#end  
#if($comp == 'B')
"customfield_XXX": "Team B",
#end  
#if($comp == 'C')
"customfield_XXX": "Team C",
#end

Of course, I have no idea what field type is your Team field and what mapping it expects... Jira dropdowns expects something different https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/

But I truly believe you understand the concept

Alex

Deva November 6, 2022

Hi Alex, 

i tried but its not working. plz check this code and let me know what i'm missing here 

set($comp = "[entry.component]")

   if($comp == 'Microservices-Infra')

      "customfield_14900": "2239",

   end

   if($comp == Microservices-RegUser)

       "customfield_2239": "2239",

    end

    if($comp == Security Testing)

       "customfield_14900": "3417",

    end

    if($comp == Regression),

       "customfield_14900": "4482",

     end    } }

Deva November 6, 2022

       "customfield_14900": "2239", is the correct one. above one was typo error. 

getting this error "Invalid format. Expected a ':' after a key at 619 [character 12 line 13]"

Alex Medved _ConfiForms_
Community Champion
November 7, 2022

Take a look at your IF conditions in the Velocity template... they are missing single quotes around the values to compare...

Also the mapping like

"customfield_14900": "2239"

is for text fields in Jira (see the documentation for Jira REST APIs) 

if your "customfield_14900" field in Jira is a select field then the mapping is usually different

"customfield_14900": { "value": "2239" }

Alex

Like Deva likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events