Expressions

The invoke and evaluate commands accept expressions, which can include variables and operators that are evaluated at runtime.

Invoke Expressions

An invoke expression is a template used to generate URL and data values at runtime by replacing the variables specified in the template with their runtime values. Variables can reference one or more selected items, information about the current user, and other system information.

  • Anything enclosed in a brace { } is considered to be a key value that is mapped to the corresponding attribute of a file, folder, or the currently signed-in user. User attributes are prefixed by user.

    For example, if John Smith is the current user, userid={user.name} resolves to this:

    userid=John Smith

  • For multiselection, use the [repeated template separator] syntax. The repeated template is resolved for each selected item, and resolved strings for items are separated by the specified delimiter.

    For example, for items with GUIDs x189 and y234, item=[{id},] resolves to this:

    item=x189,y234

Evaluate Expressions

An evaluate expression determines if the item or items selected by the user qualify for a particular action. The expression can contain zero or more variables that are replaced with their runtime values before the expression is evaluated. This expression must be a valid JavaScript expression after all the values of the variables are replaced with their values at runtime.

The expression must evaluate to true or false. If the result is true, the action is made available as specified by the trigger property. If the result is false, the action is not made available to the user.

For example, the following expression returns a true value only if all three conditions evaluate to true: the item selected in the interface is a file, the user is signed in (not accessing the file using a public link or applink), and the user is the owner of the file.

"evaluate": "type=='file' && user.isMember && user.role=='owner'

Antother example is item.meta.<custom property group name>.<custom property group field name>.

Some commonly used JavaScript comparison and logical operators follow.

Operator Description

==

equal to

!=

not equal to

>

greater than

<

less than

=

greater than or equal to

<=

less than or equal to

&&

logical and

||

logical or

!

logical not