language attribute on an arc:script keyword, as shown below:
Built-in Object Interfaces
Two main interfaces are used in ‘s Python implementation. These contain and provide access to the built-in variables listed below:ScriptContext
This represents the main scripting context object for Python scripts in . It provides dictionary-like access to items and includes logging capabilities. This interface provides access to the_ctx variable which you can use to access the context.
The available methods are:
ScriptItem
This represents individual data items in the scripting environment. It provides dictionary-like access to attributes and maintains value lists. The following variables are ScriptItem instances that are automatically available: The available methods are: At a high level,_ctx provides access to the scripting context while _input, output, and _message are pre-instantiated ScriptItem objects. Use the syntax _ctx.itemname to create or access custom items dynamically. See Built-in Variables and Operations for more information.
Built-in Variables
These variables provide access to the core of the message context in a scripting environment. Use these to interact with the items available in the scripting engine._ctx
The main variable for accessing the scripting environment. It provides:- Access to all items available in the script
- The ability to create new items, push items, and log to the application logs
log method on the _ctx variable is called to log information to the application log using the INFO log level:
_input
The read-only input item of the scripting engine. The available attributes vary based on the context in which you are writing your script (such as connector action type). For example, in a Script connector set to the Transform action, you can use the following attributes:- ConnectorId
- WorkspaceId
- MessageId
- FilePath
- FileName
- Attachment#
- Header:*
output
A built-in item that serves as an alternative to creating and pushing your own item when only a single output is needed. Unlike custom items that require you to explicitly callpush() to send them as output, the output item is automatically pushed when the script completes. You just need to modify its properties and it is automatically pushed as output once the script execution is complete, without any additional push() calls needed.
You can set attributes directly on the item or define them using a dict, and you can do the same thing with items you define yourself. The following example pushes an output file with some data:
_message
Provides access to the current message when one is loaded in context. The variable is only accessible when a message is actively being processed by a connector in these specific scenarios (such as when there is a message loaded in context). For example, the_message variable is not available in connectors whose action is set to Trigger because a message is not present until the connector is finished working. When this variable is unavailable, a _message is not defined exception appears.
You can use the following attributes:
- Header:Message-Id
- Header:FileName
- Header:*
- body
_message item and print it as an entry in the log file for the current message.
result
A special variable for use specifically in XML Map script nodes. It is treated as the result of the whole script. The value of this variable is used as the node’s value in the map. However, it can also be used as a debugging tool in Script connectors. This example, which is used in a script in a destination node of an XML Map connector, reads the source file’s address/city xpath from an Script item declared at the top, then uses Python to modify the value to be the first three letters, all capitalized. The new value is then sent as the value ofresult:
result variable is used to add entries to the log file of a Script connector:
Operations
log
log(level, message) is a method available on the _ctx variable that allows you to write entries directly to the application log. The available log levels are DEBUG, INFO, WARNING and ERROR.

push
push(item) pushes the supplied item as output of the script. If an output is not specified, the output item is pushed.
In this example a new item, foo, is created in the ScriptContext, assigned some data and a filename, then pushed out.
get
get(attr) returns the value of the specified attribute on the ScriptItem. This method provides a programmatic way to access item attributes by name. It is functionally equivalent to accessing the attribute directly using dot notation (such as _input.myattr) or using dictionary-style access (such as _input.get('myattr')).
The following example prints the value list of the tags attribute on the item object to the log file of the current script.
clear
clear() clears the ScriptItem on which the method is called. The item remains the same, just empty.
- Before clear:
{"price":"2.99","name":"Milk","tags":["perishable","dairy","noreturn"]} - After clear:
{}