Velocity Template Language

Defining the Asset Library Location Expression

The expression required to indicate an asset library location is based on Velocity Template Language (VTL). VTL is meant to provide the easiest, simplest, and cleanest way to execute dynamic content. VTL uses three types of references: variables, properties, and methods. VTL is used for automated transfer tasks (Auto Transfer to Library and Auto Transfer to MediaBeacon tasks).

Variables  refer to something defined in the Java code, or it can get its value from a VTL statement itself. The shorthand notation of a variable consists of a leading “$” character followed by a VTL Identifier. A VTL Identifier must start with an alphabetic character (a .. z or A .. Z):

$date
$customfields

Properties have a distinctive format. The shorthand notation consists of a leading $ character followed a VTL Identifier, followed by a dot character (“.”) and another VTL Identifier. These are examples of valid property references in the VTL:

$customer.Address
$purchase.Total

Methods are defined in the Java code and are capable of doing something useful, like running a calculation or arriving at a decision. Methods are references that consist of a leading “$” character followed a VTL Identifier, followed by a VTL Method Body.

$customer.getAddress()
$purchase.getTotal()
$page.setTitle( ‘My Home Page’ )
$person.setAttributes( [‘Strange’, ‘Weird’, ‘Excited’] )

Variables allowed for Asset Library Location Expressions

Variable
Description
${cfs.get(‘FieldID’)}
Captures the custom field value for the selected custom field ID. Allowed custom fields: String free text, String list single select (constrain / non-constrain), and Company single select.
/FolderName /SubFolderName
Indicates the location path where an approved file will be transferred to on completion. Can be followed with subfolders, or other variables to complete the expression. For example, /Assets/Folder1.  Do not include the root folder “Folders,” as this will not work in the expression and may cause the transfer to fail. The location path is valid with or without the trailing slash, so /Assets/Folder1 and /Assets/Folder1/ are both valid location paths.
${date.get(‘yyyy’)}
Captures the date – year, as indicated by the variable. In this example, uses the current year, yyyy = 2017
${date.format(‘yyyy’), $cfs.get(‘Field_Date’)}
Captures the date value (year) that is populated in the indicated custom field.
${date.get(‘MMMMMMMMM’)}
Captures the date – month, as indicated by the variable, in which “M” represents the month.  Note:  If you want the full month name, you must add the number of M’s in the expression to the maximum number of letters for a month, which would be September (9 characters).

Example Auto Transfer to Library Location

Here are some examples of how you can use velocity expressions for the Auto Transfer to Library asset location. These are examples of expressions to transfer the approved file to a specific location in the assets folder, driven by the values from brand, product, and SKU custom fields, or by a specific folder location.

/Assets/${cfs.get(‘brand’)}/${cfs.get(‘product’)}

/Assets/${cfs.get(‘brand’)}/${cfs.get(‘product’)}/${cfs.get(‘sku’)}

/Assets/2019 Approved Files Folder

Example Auto Transfer to MediaBeacon Location

Here are some examples of how you can use velocity expressions for the Auto Transfer to MediaBeacon location.

/Assets/Production Artwork/${cfs.get(‘region’)} Production Artwork/${cfs.get(‘brand’)}/${cfs.get(‘product’)}

/artwork/2019/Blue Daily

Note: Make sure the single quotes are the straight up-and-down ones ( ‘ ) and not the curvy ones (‘ and ’ ) which other programs (like Word) create. The expression will not work with the curvy single quotes