With ConfiForms IFTTT macros it is important to note that:
Macro body is evaluated as Velocity Template! This allows you to use #if #end constructions around JSON mapping parts. Field values are stored in Velocity templates under field names! This means that you can access fields via ${somefield} For example, to check if the value presents in field "someField"
For multi-value holding fields and for the single choice fields, like dropdowns, radio group fields, etc the field is always present in the context and has the value, so you cannot check it with
as it will always be evaluated to true, INSTEAD you can check if it has any values
Single choice field
Checking if multi-value field has certain label or id
Also, there is standard set of objects inside the context
Since ConfiForms version 1.49.3 there are additional objects in the context:
Since ConfiForms version 2.27.3
See Apache velocity tools for detailed documentation on these helper classes Since ConfiForms version 3.10.0 New class that allows you to query other forms for data right inside your Velocity template Available under "dataLoader" and allows you to query other forms.
Very similar to what is available in the context when you develop Confluence user macros: https://confluence.atlassian.com/doc/writing-user-macros-4485.html https://developer.atlassian.com/server/confluence/confluence-objects-accessible-from-velocity/ which you can reference as any other variable in Velocity using velocity syntax, for example: ${page.id} to reference page id of current page Also, a helpful link from apache ---- copied from Apache https://wiki.apache.org/velocity/CheckingForNull Q: I want to check for null, something like this: #if ($car.fuel == null) A: There are several approaches. Select the one most suitable depending on what you really want to do. (Thanks, everybody, for all the feedback on the user list.) See also: Bugzilla #20999, Bugzilla #27741, VelocityNullSupport. Approach 1: Use the fact that null is evaluated as a false conditional. (cf. http://velocity.apache.org/engine/devel/user-guide.html#Conditionals) #if( ! $car.fuel )
Approach 2: Use the fact that null is evaluated as an empty string in quiet references. (cf. http://velocity.apache.org/engine/devel/user-guide.html#quietreferencenotation) #if( "$!car.fuel" == "" )
BTW, just checking for empty can be achieved by: #if( "$car.fuel" == "" ) Approach 3: Combine Approach 1 and 2. This will check for null and null only. #if ((! $car.fuel) && ("$!car.fuel" == ""))
Approach 4: Use a Tool that can check for null (NullTool,ViewNullTool). #if( $null.isNull($car.fuel) )
|