Custom Conditionals
The conditional template blocks are evaluated using velocity macros, which are defined in the same velocity macro library as the merge fields themselves. The location of the velocity macro library is
tomcat/webapps/cb/config/templates/export/mergefields.vm
The new conditional macros can be added to this file. The name of the macro can then be used as a name for conditional blocks. The JSON representation of the item is available through the $item variable, which is an instance of com.google.gson.JsonObject. See API documentation here: : GSON API 2.3.1
An example of the same is as follows:
#macro(if_folder)

#set($type = $item.getAsJsonObject("type").get("name").getAsString())

#if ($type == "Folder")

true

#else

false

#end

#end
Was this helpful?