Confiforms sending Labels to JIRA

Rayman Bacchus April 5, 2024

For the life of me I cannot figure out why this is not working:  When posting to JIRA I have this:
"labels":      ["WOF-Intake"],   and it works as expected.

THe issue I have is that I have several choices (6) and I want a different label depending on choice:

#if(${ProductFamily.id} =='01')  
"labels":        ["FC-Prevent","WOF-Intake"],
#end

#if(${ProductFamily.id} =='02') 
"labels":      ["FC-Detect","WOF-Intake"], 
 #end

#if(${ProductFamily.id} =='03') 
"labels":      ["FC-Response","WOF-Intake"], 
#end

#if(${ProductFamily.id} =='04')
"labels":      ["FC-Performance","WOF-Intake"], 
#end

#if(${ProductFamily.id} =='05')
"labels":      ["FC-Prevent-CIAM","WOF-Intake"],
#end

#if(${ProductFamily.id} =='06')
"labels":      ["FC-Integration","WOF-Intake"], 
#end   

I have a Multiselect field called ProductFamily with the following options:

 

Id

label

01

Fin Crimes Prevent

02

Fin Crimes Detect

03

Fin Crimes Response

04

Fin Crimes Performance

05

Fin Crimes Prevent - CIAM

06

Fin Crimes Integration

 

1 answer

1 accepted

1 vote
Answer accepted
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.
April 5, 2024

Hi

see how values in multi-value fields could be checked in velocity https://wiki.vertuna.com/display/CONFIFORMS/IFTTT+macro+body+evaluates+as+Velocity+template

Alex

Rayman Bacchus April 5, 2024

THanks Alex!  
THis "almost" worked.  I now have this:

         #if(${ProductFamily.hasId("01")})
                      "labels":        ["FC-Prevent","WOF-Intake"]
         #end
         
          #if(${ProductFamily.hasId("02")})  
                      "labels":  ["FC-Detect","WOF-Intake"],
         #end
         

          #if(${ProductFamily.hasId("03")})
                       "labels":  ["FC-Response","WOF-Intake"], 
         #end 

         #if(${ProductFamily.hasId("04")})     
                         "labels":  ["FC-Performance","WOF-Intake"], 
           #end 

           #if(${ProductFamily.hasId("05")})
                         "labels":  ["FC-Prevent-CIAM","WOF-Intake"], 
           #end 

           #if(${ProductFamily.hasId("06")})     
                           "labels":  ["FC-Integration","WOF-Intake"], 
            #end   

The issue being that if multiple ProductFamily's are selected in the multi-select I run into a duplicate field "labels" issue

Rayman Bacchus April 5, 2024

I should be able to do this with multiple IFTTT's saying to update jira but wondering if there is a simpler solution

 

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.
April 5, 2024

It is a Velocity templating - you definitely can do more in a template :-)

For example

#set($labels = [])

#set($added = $labels.add("WOF-Intake"))

#if(${ProductFamily.hasId("01")})  
#set($added = ${labels.add("FC-Prevent")})
#end

#if(${ProductFamily.hasId("02")}) 
 #set($added = ${labels.add("FC-Detect")})
#end

#if(${ProductFamily.hasId("03")}) 
 #set($added = ${labels.add("FC-Response")})
#end

#if(${ProductFamily.hasId("04")})
 #set($added = ${labels.add("FC-Performance")})
#end

#if(${ProductFamily.hasId("05")})
 #set($added = ${labels.add("FC-Prevent-CIAM")})
#end

#if(${ProductFamily.hasId("06")})
 #set($added = ${labels.add("FC-Integration")})
#end   

"labels":  [#foreach( $lab in $labels ) #if($velocityCount > 1),#end "${lab}" #end],

Alex

Rayman Bacchus April 6, 2024

Thanks as always Alex.  THis solution worked.  I guess I need to learn Velocity to continue with my Confiforms skill, but as always i thank you for your solution.

 

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.
April 6, 2024

Not for ConfiForms… mainly for ConfiForms to Jira integration and the effective usage of offered tools :) 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events