Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,297,838
Community Members
 
Community Events
165
Community Groups

Embedded Velocity Variable in Form Field Call

Edited

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

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

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?

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.

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.

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
Community showcase
Published in Confluence

An update on Confluence Cloud customer feedback – June 2022

Hi everyone, We’re always looking at how to improve Confluence and customer feedback plays an important role in making sure we're investing in the areas that will bring the most value to the most c...

97 views 0 0
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you