ConnectMagic: Sync Scripts
Sync Scripts
Sync Scripts let you handle sync events with custom C# code and route events to the right script. Use them when a mapping expression is not enough and you need real logic to process an event.
What you see
- Script list — your scripts, each with its version badges, and a button to create a new one.
- Code editor — a C# editor for the script body. The entry point is
ProcessAsync(IEventScriptContext context, CancellationToken cancellationToken). You can save details, delete, load an earlier version, or Save as new version. - Send test payload — paste a JSON payload and run the script against a live sync to see the outcome or error before you rely on it.
- Routing rules — for the selected test sync's active version, the ordered rules that decide which script an event goes to. Each rule has an NCalc match expression, a target script, a rank, and a stop on match flag.
How routing works
When an event arrives, ConnectMagic evaluates the routing rules in rank order. The first rule whose match expression is true sends the event to its target script; if that rule stops on match, evaluation ends, otherwise lower-ranked rules are also considered.