Version: 5.18.0
- 2024-10-15
Link: Documentation on GitHub
whoosh Oktopus uses Scriban as scripting/templating engine.
Check out the
- Scriban language syntax in a templating context (within
{{
and}}
) - Scriban built-in functions, which proviede a broad set of base capabilities
for further information.
This document describes the built-in functions provided by whoosh Oktopus (in addition to Scriban built-in functions).
array
functionsconvert
functionsdateOnly
functionsglobalVariable
functionshtml
functionsjson
functionsoktopus
functionsstep
functionsstring
functionstimeonly
functionsvariable
functionsworkflow
functions
Array functions available through the object 'array' in whoosh Oktopus.
array.isNullOrEmpty <list>
Returns if an input list
is null or empty. The shortcut array.empty
can be used instead.
list
: The input list
true if list
is empty; otherwise false
input
{{ array.isNullOrEmpty [] }}
{{ array.isNullOrEmpty [1, 2, 3] }}
output
true
false
array.hasItems <list>
Returns if an input list
has elements.
list
: The input list
true if list
has elements; otherwise false
input
{{ array.hasItems [1, 2, 3] }}
{{ array.hasItems [] }}
output
true
false
array.remove <list> <remove>
Removes an element from an input list
.
list
: The input listremove
: The element to remove from thelist
. Must be a scalar value
A new list with the element removed
input
{{ array.remove [1, 2, 3] 1 }}
output
[2, 3]
Convert functions available through the object 'convert' in whoosh Oktopus.
convert.toCsv
convert.toCsvRows
convert.toDecimal
convert.toDouble
convert.toInt
convert.toLong
convert.toText
convert.toCsv <value> <header>?
Converts the input value
to a CSV. An optional header
can be passed to specify the CSV header.
If the header
is not specified then the return will have no CSV header.
value
: The input objectheader
: An optional string of comma-separated values that represent the CSV header
The input value
converted to a CSV
input
{{ convert.toCsv {Id:1,Text:"Foo"} }}
{{ convert.toCsv {Id:1,Text:"Foo"} "Id,Text" }}
{{ convert.toCsv [{Id:1,Text:"Foo"},{Id:2,Text:"Bar"}] "Id,Text" }}
output
1,Foo
Id,Text
1,Foo
Id,Text
"{Id: 1, Text: ""Foo""}","{Id: 2, Text: ""Bar""}"
convert.toCsvRows <value> <header>?
Converts the input value
to a CSV rows. An optional header
can be passed to specify the CSV header.
If the header
is not specified then the return will have no CSV header.
value
: The input objectheader
: An optional string of comma-separated values that represent the CSV header
The input value
converted to CSV rows
input
{{ convert.toCsvRows {Id:1,Text:"Foo"} }}
{{ convert.toCsvRows {Id:1,Text:"Foo"} "Id,Text" }}
{{ convert.toCsvRows [{Id:1,Text:"Foo"},{Id:2,Text:"Bar"}] "Id,Text" }}
output
1,Foo
Id,Text
1,Foo
Id,Text
1,Foo
2,Bar
convert.toDecimal <value> <culture>?
Converts the input value
to a 128 bit decimal. An optional culture
can be passed to specify the format of the value
.
If the culture
is not specified then the default will be used.
value
: The input objectculture
: An optional string of the culture format
The input value
converted to a 128 bit decimal
input
{{ convert.toDecimal "1.337,01" "de" }}
{{ convert.toDecimal "1,337.01" "en" }}
output
1337.01
1337.01
convert.toDouble <value> <culture>?
Converts the input value
to a 64 bit double. An optional culture
can be passed to specify the format of the value
.
If the culture
is not specified then the default will be used.
value
: The input objectculture
: An optional string of the culture format
The input value
converted to a 64 bit double
input
{{ convert.toDouble "1,337" "de" }}
{{ convert.toDouble "1,337" "en" }}
output
1.337
1337
convert.toInt <value> <culture>?
Converts the input value
to a 32 bit integer. An optional culture
can be passed to specify the format of the value
.
If the culture
is not specified then the default will be used.
value
: The input objectculture
: An optional string of the culture format
The input value
converted to a 32 bit integer
input
{{ convert.toInt "1,337" }}
{{ convert.toInt "1337" }}
output
1337
1337
convert.toLong <value> <culture>?
Converts the input value
to a 64 bit integer. An optional culture
can be passed to specify the format of the value
.
If the culture
is not specified then the default will be used.
value
: The input objectculture
: An optional string of the culture format
The input value
converted to a 64 bit integer
input
{{ convert.toLong "1,337" }}
{{ convert.toLong "1337" }}
output
1337
1337
convert.toText <value>
Converts the input value
to a string. The shortcut convert.toString
can be used instead.
value
: The input object
The input value
converted to a string
input
{{ convert.toText 1.337 }}
{{ convert.toText 1337 }}
output
"1.337"
1337
DateOnly functions available through the object 'dateOnly' in whoosh Oktopus.
dateOnly.from <dateTime>
Returns the date string of an input dateTime
.
dateTime
: The input datetime object
The date string of the dateTime
input
input
{{ dateOnly.from date.now }}
{{ dateTime = date.parse "2024/12/31 13:37:00Z"; dateOnly.from dateTime }}
output
2024-01-01
2024-12-31
dateOnly.now
Returns a date string of the current time.
input
{{ dateOnly.now }}
output
2024-01-01
dateOnly.parse <dateString> <culture>?
Returns a date string of an input date string. An optional culture
can be passed to specify the format of the dateString
.
If the culture
is not specified then the default will be used.
dateString
: The input date stringculture
: An optional string of the culture format
A date string of the input dateString
input
{{ dateOnly.parse "2024-01-01" }}
{{ dateOnly.parse "2024/12/31" }}
{{ (dateOnly.parse "2024-12-31") | object.format "m" }}
{{ dateOnly.parse "31-12-2024" "de" }}
output
2024-01-01
2024-12-31
December 31
2024-12-31
dateOnly.today
Returns a date string of the current time.
input
{{ dateOnly.today }}
output
2024-01-01
Global variable functions available through the object 'globalVariable' in whoosh Oktopus.
globalVariable.load <globalVariableName>
Returns the value of a global variable. Global variables have to be set with a name and a value under Global variables
globalVariableName
: The name of the global variable
The value of the input globalVariableName
input
{{ globalVariable.load "MyGlobalVariable" }}
output
"MyValue"
globalVariable.store <value> <globalVariableName>
Stores a global variable of an input value
. If the globalVariableName
already exists then the new value
will be stored, otherwise the new globalVariableName
and the value
will be added under Global variables
. The shortcut globalVariable.set
can be used instead.
value
: The input objectglobalVariableName
: The name of the global variable
input
{{ globalVariable.store "MyValue" "MyGlobalVariable" }}
output
Storing global variable 'MyGlobalVariable'='MyValue'
HTML functions available through the object 'html' in whoosh Oktopus.
html.removeAllAttributes <htmlString>
Removes all attributes of the input htmlString
.
htmlString
: The input HTML string
A new HTML string with all attributes removed
input
{{ html.removeAllAttributes "<html><head></head><body><p src='FooBar'>FooBar</p></body></html>" }}
output
<html><head></head><body><p>FooBar</p></body></html>
html.removeAttributes <htmlString>
Removes the attributes of the input htmlString
. XML namespaces, src and href are not removed by this function, if you want to remove all attributes then use html.RemoveAllAttributes
.
htmlString
: The input HTML string
A new HTML string with the attributes removed
input
{{ html.removeAttributes "<html><head></head><body><p title='FooBar'>FooBar</p></body></html>" }}
output
<html><head></head><body><p>FooBar</p></body></html>
JSON functions available through the object 'json' in whoosh Oktopus.
json.deserialize <jsonString>
Deserializes the input jsonString
. The shortcut json.parse
can be used instead.
jsonString
: The input JSON string
A new JSON object
input
{{ json.deserialize '{"Foo":"Bar"}' }}
output
{Foo: "Bar"}
json.format <jsonString>
Indents the input jsonString
.
jsonString
: The input JSON string
A new formatted JSON string
input
{{ json.format '{"Foo":"Bar"}' }}
output
{
"Foo":"Bar"
}
json.serialize <json> <options>?
Serializes the input json
. If options
is set to "Indented" then the resulting JSON string will be intended.
json
: The input JSON objectoptions
: An optional string that can be set to "Indented"
A new JSON string
input
{{ json.serialize {Foo:"Bar"} }}
{{ json.serialize {Foo:"Bar"} "Indented" }}
output
{"Foo":"Bar"}
{
"Foo":"Bar"
}
Oktopus information functions available through the object 'oktopus' in whoosh Oktopus.
oktopus.server
Returns a JSON of relevant information of the current whoosh Oktopus instance.
input
{{ oktopus.server }}
{{ oktopus.server.uptime | object.format "%d" }}
output
{"MachineName":"TESTDEV","Uptime":"1.33:07:00.1337000","Version":"5.9.0","EnvironmentName":"Test Environment"}'
1
Oktopus step functions available through the object 'step' in whoosh Oktopus. These functions can be set to control the workflow to enable branching in steps or enable advanced error handling.
step.errorMessage
step.item
step.retry
step.retryIn
step.skip
step.skipIf
step.skipIfEmpty
step.skipIfNull
step.wait
step.errorMessage
Returns the error message of when a step fails. This is typically used under Advanced Settings
in the Error handling script
.
input
if (step.errorMessage | string.contains "temporarily unavailable") step.retryIn (timespan.from_seconds 5) end
output
<input>(1,1): Waiting for 5000ms...
Error handling script decided to retry step [...]
step.item
Returns the item set in the current step context. This can be used in certain steps like Create or update Business Object(s)
in the Ivanti Service Manager
technology by using an item, like a JSON, in the Items (mass upsert)
field. In other fields set in the current step you can iterate over the item by using step.item
and a key that is set in the item.
input
{{ step.item.id }}
{{ step.item.name | convert.toCsv }}
output
step.retry
Retries a step if it fails. This is typically used under Advanced Settings
in the Error handling script
.
input
{{ step.retry }}
output
Error handling script decided to retry step [...]
step.retryIn <timespan>
Waits for a given timespan
( set in milliseconds ) and then retries a step if it fails . This is typically used under Advanced Settings
in the Error handling script
.
timespan
: The input timespan object
input
{{ step.retryIn (timespan.from_seconds 5) }}
output
<input>(1,1): Waiting for 5000ms...
Error handling script decided to retry step [...]
step.skip
Skips the current step. This is typically used under Advanced Settings
in the Error handling script
.
input
{{ step.skip }}
output
Skipping step [...]
step.skipIf <value>
Skips the current step if the input value
evaluates to true.
value
: The input object
input
{{ step.skipIf true }}
{{ step.skipIf false }}
output
Skipping step [...]
Successfully executed step [...]
step.skipIfEmpty <value>
Skips the current step if the input value
is null or is an empty string.
value
: The input object
input
{{ step.skipIfEmpty null }}
{{ step.skipIfEmpty "" }}
{{ step.skipIfEmpty {} }}
output
Skipping step [...]
Skipping step [...]
Successfully executed step [...]
step.skipIfNull <value>
Skips the current step if the input value
is null.
value
: The input object
input
{{ step.skipIfNull null }}
{{ step.skipIfNull {} }}
output
Skipping step [...]
Successfully executed step [...]
step.wait <timespan>
Waits for a given timespan
( set in milliseconds ). This is typically used under Advanced Settings
in the Error handling script
.
timespan
: The input timespan object
input
{{ step.wait (timespan.from_seconds 5) }}
{{ step.wait 5) }}
output
<input>(1,1): Waiting for 5000ms...
<input>(1,1): Waiting for 5ms...
String functions available through the object 'step' in whoosh Oktopus.
string.getFileName <name> <extension> <fallbackName>?
Returns the file name of of the input name
and extension
. The optional fallbackName
will be used if name
contains invalid characters, like '/', '', '<', '>', '|', ':', '*', '?' or '"'.
name
: The input string of the resulting file nameextension
: The input string of the resulting file name extensionfallbackName
: An optional string that is used instead ofname
A new string of file name
input
string.GetFileName "Test" "eml" "Email"
string.GetFileName "<>" "eml" "Email"
output
Test.eml
Email.eml
string.hasContent <value>
Returns if an input value
has content.
value
: The input string
true if value
has content; otherwise false
input
{{ string.hasContent "Test" }}
{{ string.hasContent "" }}
output
true
false
string.isNullOrEmpty <value>
Returns if an input value
is null or empty.
value
: The input string
true if value
is empty; otherwise false
input
{{ string.isNullOrEmpty "" }}
{{ string.isNullOrEmpty "Test" }}
output
true
false
TimeOnly functions available through the object 'timeOnly' in whoosh Oktopus.
timeOnly.from <dateTime>
Returns a time object of an input dateTime
.
dateTime
: The input datetime object
A new time object of the dateTime
input.
input
{{ timeOnly.from date.now }}
{{ dateTime = date.parse "2024/12/31 13:37:00Z"; timeOnly.from dateTime }}
output
13:37:00.0000000
14:37:00.0000000
timeOnly.now
Returns a new time object of the current time.
input
{{ timeOnly.now }}
output
13:37:00.0000000
timeOnly.parse <timeString> <culture>?
Returns a time object of an input time string. An optional culture
can be passed to specify the format of the timeString
.
If the culture
is not specified then the default will be used.
timeString
: The input time stringculture
: An optional string of the culture format
A new time object of the input dateString
input
{{ timeOnly.parse "13:37:00" }}
{{ (timeOnly.parse "13:37:00") | object.format "HH" }}
{{ timeOnly.parse "1:37 PM" }}
output
13:37:00.0000000
13
13:37:00.0000000
Variable functions available through the object 'variable' in whoosh Oktopus.
variable.skip
variable.skipIf
variable.skipIfEmpty
variable.skipIfNotEmpty
variable.skipIfNotNull
variable.skipIfNull
variable.store
variable.useNull
variable.skip
Skips the variable of a step.
input
{{ variable.skip }}
output
Ignoring [...]
variable.skipIf <value>
Skips the variable of a step if the input value
evaluates to true.
value
: The input object
input
{{ variable.skipIf true }}
{{ variable.skipIf false }}
output
Ignoring [...]
Successfully executed step [...]
variable.skipIfEmpty <value>
Skips the variable of a step if the input value
is null or is an empty string. The shortcut variable.skipEmpty
can be used instead.
value
: The input object
input
{{ variable.skipIfEmpty null }}
{{ variable.skipIfEmpty "" }}
{{ variable.skipIfEmpty {} }}
output
Ignoring [...]
Ignoring [...]
Successfully executed step [...]
variable.skipIfNotEmpty <value>
Skips the variable of a step if the input value
is not an empty string. The shortcut variable.skipNotEmpty
can be used instead.
value
: The input object
input
{{ variable.skipIfNotEmpty null }}
{{ variable.skipIfNotEmpty "" }}
{{ variable.skipIfNotEmpty "{}" }}
output
Successfully executed step [...]
Successfully executed step [...]
Ignoring [...]
variable.skipIfNotNull <value>
Skips the variable of a step if the input value
is not null. The shortcut variable.skipNotNull
can be used instead.
value
: The input object
input
{{ variable.skipIfNotNull {} }}
{{ variable.skipIfNotNull null }}
output
Ignoring [...]
Successfully executed step [...]
variable.skipIfNull <value>
Skips the variable of a step if the input value
is null. The shortcut variable.skipNull
can be used instead.
value
: The input object
input
{{ variable.skipIfNull null }}
{{ variable.skipIfNull {} }}
output
Ignoring [...]
Successfully executed step [...]
variable.store <value> <variableName>
Stores the input value
with a variableName
in the current workflow context. To use the variable just call the variableName
in any step after the variable was stored.
value
: The input objectvariableName
: The string for the variable name
input
{{ variable.store "Bar" "Foo" }}
{{ variable.store {Foo:"Bar"} "FooBar" }}
output
Storing variable 'Foo'='Bar'
Storing variable 'FooBar'='{"Foo":"Bar"}'
variable.useNull
Forces null
to be used as a variable instead of an empty string.
input
{{ variable.useNull }}
output
Text = <null>
Workflow functions available through the object 'workflow' in whoosh Oktopus.
workflow.hideSecret
workflow.log
workflow.stop
workflow.stopIf
workflow.stopIfEmpty
workflow.stopIfNull
workflow.hideSecret <value>
Prevent logging the clear text of the value
.
input
{{ workflow.hideSecret user.password }}
output
workflow.log <value> <logLevel>?
Logs the value
under "Protocol" after the step was executed where the function was called. An optional logLevel
string ( "[Success | Warning | Error]" ) can be used for advanced logging.
input
{{ workflow.log "FooBar" }}
{{ workflow.log "FooBar" "Success" }}
output
๐FooBar
โ
FooBar
workflow.stop <message>?
Stops the current workflow. An optional message
string can be used to display a reason why the workflow stopped.
message
: An optional message string
input
{{ workflow.stop }}
{{ if MyVariable == "Abort" workflow.stop "Stopping workflow now." end }}
output
Stopping workflow at step [...]
Stopping workflow at step [...] "Stopping workflow now."
workflow.stopIf <value> <message>?
Stops the current workflow if the input value
evaluates to true. An optional message
string can be used to display a reason why the workflow stopped.
value
: The input objectmessage
: An optional message string
input
{{ workflow.stopIf true }}
{{ workflow.stopIf MyVariable == "Abort" "Stopping workflow now." }}
{{ workflow.stopIf false }}
output
Stopping workflow at step [...]
Stopping workflow at step [...] "Stopping workflow now."
Successfully executed step [...]
workflow.stopIfEmpty <value> <message>?
Stops the workflow if the input value
is null or is an empty string. An optional message
string can be used to display a reason why the workflow stopped.
value
: The input objectmessage
: An optional message string
input
{{ workflow.stopIfEmpty null }}
{{ workflow.stopIfEmpty "" "Stopping workflow now." }}
{{ workflow.stopIfEmpty {} }}
output
Stopping workflow at step [...]
Stopping workflow at step [...] "Stopping workflow now."
Successfully executed step [...]
workflow.stopIfNull <value> <message>?
Stops the current workflow if the input value
is null. An optional message
string can be used to display a reason why the workflow stopped.
value
: The input objectmessage
: An optional message string
input
{{ workflow.stopIfNull null }}
{{ workflow.stopIfNull null "Stopping workflow now." }}
{{ workflow.stopIfNull {} }}
output
Stopping workflow at step [...]
Stopping workflow at step [...] "Stopping workflow now."
Successfully executed step [...]