- Script — a scripting language used to automate workflows, transform data, and customize connector behavior through simple, XML-based commands.
- Python — a programming language used to process data, automate workflows, and build custom applications across a wide range of platforms and industries.
Scripting Hooks
exposes three primary hooks into the scripting language: the Events on all connectors, the dedicated Script connector, and the custom script option in the XML Map connector.Event Scripting
Each connector exposes opportunities to execute a custom script at specific moments during the processing of a file. These are called events.-
The
Before Sendevent fires after a connector has fully prepared a file to send/process a file, but before the sending/processing actually occurs. -
The
After Sendevent fires after the connector has sent the file. This event only applies to connectors that send files outside of the application (such as uploading a file to a remote server). -
The
After Receiveevent fires after the connector creates a new file. This newly created file might be the result of receiving a file from an outside source (such as receiving a message over AS2) or from modifying or transforming a file already in the flow (for example, converting an EDI file into XML causes a new XML file to be created).
After Receive event of the AS2 connector responsible for receiving the file.
You cannot use event scripts to create files directly into a flow, or to modify the contents of the files through a flow.
Error Handling in Events
Event script execution is triggered by the successful sending or receiving of a file, so errors thrown in the script do not affect the status of the send/receive operation. For this reason, you should limit scripting in events to scripts that are guaranteed to succeed, or that can fail without impacting the overall flow. To ensure that an exception in a script causes a file to stop processing, move the script into a dedicated Script connector, which is described in the next section. Using a Script connector also allows for errors to be logged to the Activity page, and for using the retry functionality for operations that fail.Script Connector
includes a dedicated connector for executing custom scripts. You can trigger a Script connector in a flow by passing a file to the connector (in the same way as any other connector), or you can use the Receive Automation setting to have it automatically execute according to a specified interval. Script connectors are the most flexible way in which to execute custom logic in Script. In addition, the flow can be easier to understand and maintain if script execution is represented visually with a dedicated connector, instead of being configured in an Event of another connector. Script connectors can generate output files using thepush keyword, or simply execute some logic without generating any output.
XML Map Connector
The XML Map connector provides a visual designer to transform XML from one structure to another. The primary way to use the XML Map designer is by dragging and dropping elements from the source tree to the destination tree. This simple approach is augmented with scripting concepts to support extensible custom processing during mapping. The XML Map connector’s Node Value Editor uses Script’s Formatters to dynamically modify and format data during the mapping. These expressions do not require other aspects of scripting, such as setting variables and calling operations. The XML Map connector also has a custom script editor for specific element mappings. All Script features are available in custom scripts to support arbitrary business logic during a mapping. These scripts have a unique requirement where theresult.text attribute is set to the output value (the value that should be set in the mapped XML element) by the end of script execution.