IFTTT and velocity

Augustus Corso October 6, 2020

I don't have a lot of control of my confluence configuration and i am not a web developer by trade. so forgive me if i am butchering the definitions.

Im trying to use a confiform to create a JIRA issues

i wanted to use velocity code to help "build an array of labels to add to an issue

But i have had zero luck with using velocity variables in my enviroment.

{ "fields":{
"project":{"key":"somekey"},
"issuetype":{"name":"Software Design"},
"priority":{"name":"Medium"},
"components":[{"name":"[entry.ClassSelector.escapeJSON]"}],
"description":"[entry.issueDetails.escapeJSON]",

#if ("[entry.valueSeverity.escapeJSON]" != "")
"customfield_11853":{"value":"[entry.valueSeverity.escapeJSON]"},
#end

#if([entry.IsShipCheckReq] == true)
#set( $labelStr = "ShipCheckReq," )
#end
#if([entry.IsDiscrep] == true)
#set( $labelStr = "$labelStr discrep," )
#end
#if([entry.IsSafetyCritical] == true)
#set( $labelStr = "$labelStr Safety," )
#end
#if([entry.isFleetsupport] == true)
#set( $labelStr = "$labelStr FleetSupport," )
#end
#if([entry.isTask] == true)
#set( $labelStr = "$labelStr Task," )
#end
#set( $labelStr = "$labelStr""formGenerated""" )

"labels":["$labelStr"],
"summary":"[entry.issueName.escapeJSON]" }
}

 

 

1 answer

1 accepted

0 votes
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.
October 6, 2020

Hi

Please see this page on how you actually mix the Velocity with ConfiForms Field value references https://wiki.vertuna.com/display/CONFIFORMS/Configuring+ConfiForms+IFTTT+actions+and+rules#ConfiguringConfiFormsIFTTTactionsandrules-CreateJiraIssue

Especially how to check if the value is given or not.

Alex

Augustus Corso October 9, 2020

thanks for the response.

I think if i knew what i was doing that page would be helpful, but i don't so it wasn't.

 

i wound up solving this by redoing the page as replacing check boxes with a multi select label box.

 

I guess i have another question?

Is it possible to build a string like i was attempting and pass it in as an array of labels?

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 9, 2020

Consider the following template (I have 3 fields of type checkbox and I am checking their "RAW" value, as described in our docs)

Screenshot 2020-10-09 at 22.50.15.png

 

And the template itself

#set ($labelStr = "") 

#if(${check1})  
#set ($labelStr = $labelStr + "Check1, ")
#end

#if(${check2})   
#set ($labelStr = $labelStr + "Check2,")
#end

#if(${check3})   
#set ($labelStr = $labelStr + "Check3,")
#end

{ "fields": { "project": { "key": "somekey" }, "issuetype": { "name": "Software Design" }, "priority": { "name": "Medium" }, "components": [ { "name": "[entry.ClassSelector.escapeJSON]" } ], "description": "[entry.issueDetails.escapeJSON]", "labels": [ "$labelStr" ], "summary": "[entry.issueName.escapeJSON]" }
Like Drew T likes this
Augustus Corso October 13, 2020

thank you for the template!

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events