Skip to main content
Administrator Guide
Last Updated: 2023-06-23
Reference: Studio MVEL Auto-Conversion Syntax Samples

Reference: Studio MVEL Auto-Conversion Syntax Samples

Function
Sample Expression
Description
Auto-convert a string to a variable.
vars['fred'] = '<hello>world</hello>'
Creates a new variable called
fred
with the content
<hello>world</hello>
.
Use this method to create small messages only. Using expressions to create large strings can lead to poor performance.
In most cases, you should use the
write
step to create content for a variable.
Supply content and MIME type information to a variable.
vars['fred'] = [ 'Hello World', 'text/plain' ]
Creates a new variable called
fred
with the content
Hello World
and MIME type
text/plain
.
Use this method to create small messages only. Using expressions to create large strings can lead to poor performance.
In most cases, you should use the
write
step to create content for a variable and configure the MIME type.
Copy from an attachment to a variable.
vars['fred'] = parts[1]
Creates a new variable
fred
from the first attachment of the current message.
In most cases, you should use the
copy
step to take input from an attachment.
Copy from a message to a variable.
vars['fred'] = message
Creates a new variable
fred
from the entire message.
In most cases, you should use the
copy
step to take input from the current message.
Supply content and MIME type information to a variable whose value is an expression.
vars['fred'] = [23 + 5, 'text/plain']
Creates a new variable called
fred
with content
28
and MIME type
text/plain
.
Create a variable from an XPath fragment in the message root part.
vars['fred'] = parts[0].xpathF('/dink/donk')
Creates a new variable called
fred
with an XPath fragment from the root part of the current message.
Use this method to create small messages only. Using XPath expressions to create large strings can lead to poor performance.
Nullify a variable.
vars['fred'] = null
Removes the variable called
fred
.
Assign content to the root part.
parts[0] = '<hello>world</hello>'
Assigns the content
<hello>world</hello>
to the root part.
Use this method to create small messages only. Using expressions to create large strings can lead to poor performance.
In most cases, you should use the
write
step to assign content to an attachment and configure the MIME type.
Assign content to the first attachment.
parts[1] = [ 'Hello World', 'text/plain']
Assigns the content
Hello World
and MIME type of
text/plain
to the first attachment.
Use this method to create small messages only. Using expressions to create large strings can lead to poor performance.
In most cases, you should use the
write
step to assign content to an attachment and configure the MIME type.
Assign content to the root attachment and specify the MIME type.
parts[0] = [ 23 + 5, 'text/plain']
Assigns root part with content
28
and MIME type
text/plain
.
Assign content from a variable to the message part.
parts[0] = vars['fred']
Assigns the content of the variable
fred
to a message part.
In most cases, you should use the
copy
step to take input from a variable and assign it to a message part.
Remove the root part.
parts[0] = null
Removes the root part.
Copy an attachment.
parts[2] = parts[1]
Copies the first attachment into a second attachment.
In most cases, you should use the
copy
step to take input from one attachment and assign it to another.
Create a new message with the default MIME type.
context.message = '<hello>world</hello>'
Creates a new message
<hello>world</hello>
with a default MIME type of
text/xml
.
In most cases, you should use the
write
step to create a new message.
Create a new message with MIME type of
text/plain
.
context.message = [ 'Hello World', 'text/plain' ]
Creates a new message
Hello World
with a MIME type of
text/plain
.
In most cases, you should use the
write
step to create a new message.
Create a new message from variable content.
context.message = vars['fred']
Creates a new message with the same content and MIME type as the variable
fred
.
In most cases, you should use the
copy
step to create a new message from a variable.
Create a new message from the root part of the current message.
context.message = parts[0]
Creates a new message from the root part of the current message.
In most cases, you should use the
copy
step to create a new message from a message part.