Forums

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

Embedded Velocity Variable in Form Field Call

Confi User June 21, 2022

I was trying to do the following, but nothing would show up in my Jira description:

 

#set( $range= $convert.toInteger("[entry.numOfActions.id]") )        

#foreach($i in [1..$range])

#set($add = "[entry.actionType${i}]")

#set($sendAway = "$sendAway$add")

#end

"description": "$sendAway"

 

entry.numOfAction.id return 1,2,3,4 etc...

This is suppose to get the value from the field which end with different number 1 through 6 and append then into my description.

I was just wondering if it possible to do this on confiforms or is it not supported?

Also this is inside my overall Jira IFTTT oncreated request.

Thanks :)

1 answer

0 votes
Alex Medved _ConfiForms_
Community Champion
June 22, 2022

In ConfiForms the template you give is first evaluated for "[entry.field_name]" expressions, finding the values for expressions you have

And then, attempting to evaluate it as a Velocity Template

So, having something like [entry.actionType${i}] will never work, as well as using "$convert" (which is not something you have available in the Velocity context)

Alex

Confi User June 22, 2022

okay, Thanks!

If I do something like:

#($var = "entry.actionType$i")

#($add = "[$var]")

will this also not work because of the fact that it's evaluated first even though "entry." doesn't exist?

EDIT: I tried it out and it does not work, but if there a work around by any chance or am I out of luck?

Alex Medved _ConfiForms_
Community Champion
June 22, 2022

Of course it will not work as explained before (why) - there is no such thing as entry.actionType$i when [entry.field_name] expressions get processed

I am actually not sure what is the end result you want to achieve.

Confi User June 22, 2022

I am trying to make a range for loop that will access all of my fields because the only difference between all my fields is that the number at the end is different. So I wanted to dynamically change the last number before trying to access the fields and just do everything I need to do in that 1 for loop. If that doesn't make sense let me know and I can give an example.

Alex Medved _ConfiForms_
Community Champion
June 22, 2022

What you are trying to do will not work this way.

As explained earlier the expressions are evaluated BEFORE the template gets processed as Velocity template

Like Confi User likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events