Page tree
Skip to end of metadata
Go to start of metadata

Sometimes, especially when you create a mapping for JIRA issue creation from ConfiForms record you want to make some conditional statements.

Like, not sending the date value when it is not set on ConfiForms side or not send some numeric value which is, again, not set on the ConfiForms side.

To do that you will need to embed some Velocity syntax into your mapping. More about Velocity templates you can read here https://velocity.apache.org/engine/releases/velocity-1.5/user-guide.html

So, in the example below you can see that we do not send the description field if one of the description fields is not set

Important block here is:

#set($desc = "[entry.desc2]")

#if($desc)
   "description": "[entry.desc1] \n [entry.desc2]",
#end

On line #1 we set a value from field "desc2" into a local variable in Velocity

On line #3 we start an IF-END block where we check if the local variable (which we set on line #1) is set (in Velocity, an empty string is "nothing" and evaluates to "false", so when it is empty then it will not go into the IF-END block, and if not empty (and is "something") then it will go into the block and will add the description into the JIRA JSON mapping)

You can check for whatever field you need, but please remember to give unique names for local variables and check for respected variables accordingly

#set($desc = "[entry.desc2]")

Here, the variable is names $desc 

 

 

 

  • No labels