date.format(timestamp: number, format: string | nil) --string Since v264 Formats the provided timestamp using the specified format and returns it as a string
By default, the format used is Domino’s date-time format (%d-%m-%Y %H:%M:%S), which matches the format used by {{note/note:getItemValueString}} for DATETIME items.
The input timestamp should be a number of since since Unix epoch.
date.from(date: string, format: string | nil) --number | nil Parses the provided date string using the specified format and returns the number of seconds since the Unix epoch.
By default, the format used is Domino’s date-time format (%d-%m-%Y %H:%M:%S), which matches the value returned by {{note/note:getItemValueString}} for DATETIME items.
The input string is interpreted as local time using the server’s current time zone, and then converted to a UTC-based Unix timestamp. For example, if the server is in UTC+2, the parsed time is assumed to be UTC+2 before being converted.
date.now() --number Get the time in seconds since the Unix epoch.
date.parts(timestamp: number) --table Since v264 Extracts the date and time parts of the provided timestamp.
The returned table will hold the following parts: year, month, day, hour, min, sec, weekday and yearday.
The input timestamp should be a number of since since Unix epoch.
fetch(params: table) --table This function performs a standard HTTP request. The provided URL must be in a valid URL format, and the HTTP method must be written in uppercase. Supported methods are "POST", "PUT", "DELETE", and "GET", with "GET" used as the default if no method is specified. Any headers should be supplied as key–value pairs in a table structure.
Optionally, a file parameter can be provided. This should be a file object returned from {{globals/files.create}}. When a file is supplied, the request method is ignored and the request will always be executed as a "GET". When a file is provided, the response body will be written to that file instead of being returned as part of the response object.
The request is executed synchronously and returns a response-like object. The example below shows the structure of both the response and the request object.
-- Basic JSON request
local res = fetch{
url = "https://example.com/api"
method = "POST",
body = json.stringify{ foo = bar },
headers = {
["Content-Type"] = "application/json"
}
}
-- res:ok() --boolean
-- res:getHeader(key: string) --string | nil
-- res:getText() --string
-- res:getJson() --table | nil
-- res.status --number json.parse(jsonString: string) --table | nil Convert a JSON string to a JSON table
json.stringify(jsonTable: table) --string | nil Convert a JSON table to a JSON string
REQUIRE_VERSION(version: string) --nil Make sure the API version matches the provided version string. When the version doesn't comply with the API version an error is thrown.
-- Below will pass for 1.0, 1.1 and 1.0.4, but not for 2.0
REQUIRE_VERSION("1")
-- Below will pass for 1.1 and 1.1.2 but not for 1.2 and 2.0
REQUIRE_VERSION("1.1") stop(reason: string) --nil Stop the Workflow after this block and call all "stop" triggers in the current Workflow.
This function should be used for custom error-handling when the block that is currently running could realistically fail or not continue because of (for example) a parameter issue. The stop reason should be a human-processable message so the user of the Workflow could adjust their setup or parameters.
workflow.getInput() --any | nil Returns the input from the previous block exactly as received, preserving the original type.
If the previous block returns a table, you can optionally provide a second boolean argument. When set to true, the table is iterated and the next block is executed once for each item inside the table.
When calling this function inside the iteration block, two values will be returned. The first is the key (or index) of the item, the second is the value of the item. The example below shows how to use the iteration feature using an array-like table.
-- Block A
return { "Hello", "world"}, true
-- Block B (called for all items in the table)
local index, value = workflow.getInput()
print(value) -- "Hello" or "world"