Client Scripting

Client Scripting

Client scripting has been replaced by the Connexion API, and will be deprecated and/or removed in future versions.

Client scripting is an API which can be used to inspect the management application / UI state, and optionally modify device configuration. This feature was developed prior to global variables and the advanced search UI, and in newer versions of Connexion has limited usefulness.

The API allows you to search through each group, tab, channel, and device and look for specific properties. You can use this feature to search and report on all channels/devices which meet certain criteria (for example, find all HL7 Inbound devices using a specific encoding). You can also bulk modify devices to use new configuration values (for example, find all devices with setting “A” and modify them to use “B”).

Channels are not modified directly. Instead, a channel file containing the modified channels is created. You can then use the standard import mechanism (which highlights what will be changed) if you want to apply these changes to your system.

image-20250904-003539.png
Add, name and save the script

On the Script Code tab, write the code to find your channels / devices. The boilerplate code is an example of searching for HL7 Outbound devices which send to port 11000. This code also creates a channel file with an updated target port (which can be imported to apply the updates).

using System.Collections.Generic; using System.Threading.Tasks; namespace Connexion.Client { public class CustomClientScript : BaseCustomClientScript { // Two channel files are created when a script runs: // 1 - a backup of the channels which have changed (you must add these to the ChangedChannels collection) // 2 - a channel file containing the modified channels (which you can import) // The channels provided are a copies - not the actual active channels. public override async Task RunScript(IEnumerable<ChannelVm> channels) { // 1. enumerate each channel foreach(var channel in channels) { // 2. specify the type of device configurations you are interested in foreach(var outboundConfig in channel.GetDeviceConfigurationsOfType<Connexion.Device.OutboundHL7Device.OutboundHL7DeviceConfiguration>()) { // 3. device criteria if(outboundConfig.Destination.Port == 11000) { outboundConfig.Destination.Port = 11111; // when you make a change to a device/channel, make sure to add it to the 'ChangedChannels' collection ChangedChannels.Add(channel); // anything you write to the Results stringbuilder will be displayed in a messagebox at the end of the script Results.Append($"Updated channel {channel.FullName} from value '11000' to '11111'\n"); } } } } } }

If you are searching custom devices, you will need to add a reference to the assembly containing the custom device configuration.

Notice that line 23 changes the destination port. When changing configuration properties, you must add the changed channel to the ChangedChannels collection. Channels in this collection will be added to the channel file (for future import).

You can add text to the Results string builder. This text will be displayed in a message dialog once the code has finished running.

In order to run your code, click the Run Script hyperlink.

image-20250904-022440.png