$SRXEnv Environment Variable

Using the ScriptRunner Environment Variable $SRXEnv

You can use the ScriptRunner PowerShell Host Environment Variable $SRXEnv for test and development purposes.

If an SMTP server is available, the ScriptRunner service can send email notifications containing execution reports, on error or on success.

The Cmdlet Reset-SRXEnvironment is used to reset the SRXEnv variable. (This Cmdlet is not available in the ScriptRunner PowerShell Host.)

The SRXEnv hashtable provides the following keys: 

Key Type Description
ReportEmail
string Recipient email addresses (comma separated list), the full action report will be sent to these addresses.
ResultEmail
string Recipient email addresses (comma separated list), only the ResultMessage will be sent to these addresses.
ResultList
ArrayList A scripted query must specify this list of string values. The list is associated with the corresponding action parameter.
ResultList2
ArrayList

A scripted query can specify this optional list of display names. The list appears as drop-down list for the associated action parameter.

If the list is empty, the values of the ResultList list also used for display.

ResultMessage
string This message will show in the reports, and in the immediate result window of the Delegate and Self-Service App.
ResultHtml
string Contains the html for the Html representation of the report.
This HTML can be easily retrieved from
the ScriptRunner Apps/WebApps.
ResultObjectJSON
string The script can now provide (simple) structured result data by writing a (small) JSON string to $SRXEnv.ResultObjectJSON.
ScriptRunner will provide this JSON string in the OutSerializedPSObjects report field, for post-processing by the caller of the Web Service Connector.
SRXStarted 
DateTime The timestamp of the start of the script execution. (readonly)
SRXStartedBy 
string The user account that requested the execution of the script. (readonly)
SRXStartedIP 
string IP address of the client that sent the request to perform the script execution. (readonly)
SRXStartedVia 
string Name of the application that started the execution of the script. (readonly)

You can find the latest version here: SRXEnv in the PowerShell Galery

This page has been automatically translated and may contain grammatical errors or inaccuracies