NEW6.00.04 · Released 16 July 2026
NEWfinPOWER Connect
Released in
6.00.04
16 July 2026
  1. Opened5 May
  2. Closed6 May
  3. Released16 Jul
Article 22554 Job J036869

Business Layer; ISRuntime; new MarshalAcrossScripts methods for bridging Script type boundaries

A new mechanism is available for passing custom-typed objects (e.g. domain classes defined in a shared types Function Library) between Scripts.

When a Script returns an object whose type is defined in a Function Library and shared via #include, the calling Script cannot DirectCast the result to the same-named type. Each Script's #include produces its own compiled type identity - at runtime, two compiled types from the same source are distinct types and cannot be cast directly.

The following Shared methods have been added to ISRuntime:

  • MarshalAcrossScripts(sourceObj As Object, objectType As System.Type) As Object - base form, takes an explicit System.Type
  • MarshalAcrossScripts(Of T)(sourceObj As Object) As T - generic convenience overload
  • MarshalAcrossScripts(Of T)(values As ISKeyValueList, key As String) As T - pulls the source object out of an ISKeyValueList by key

Each round-trips the source object through JSON to materialise it as the calling Script's local type.

Typical usage - a Portal page receiving a list of custom objects from its Data Adaptor Script:

Dim Opportunities As List(Of InvestmentOpportunity)

Opportunities = ISRuntime.MarshalAcrossScripts(Of List(Of InvestmentOpportunity))(ReturnValues, "Opportunities")

If Opportunities Is Nothing Then
  Success = False
  finBL.Error.ErrorBegin("Failed to marshal Opportunities using ISRuntime.MarshalAcrossScripts.")
End If

The same pattern applies in both directions:

  • For return values - set the object on the return-values KVL; the caller marshals to its local type
  • For parameters - set the object on the parameters KVL; the callee marshals to its local type

Supported types: simple data classes whose fields are primitives (String, Integer, Decimal, Date, Boolean, Date?), enums, or lists or nested classes of those.

Not supported:

  • Polymorphism (Inherits hierarchies that rely on subclass identity)
  • Read-only properties without setters
  • Cyclic references
  • Object identity preservation (two references to the same object become two distinct copies after round-trip)

Errors: throws InvalidOperationException (with the underlying serialiser exception as InnerException) on serialise or deserialise failure. Returns Nothing for a Nothing input.

Cost: each call serialises and deserialises the entire object. Cheap for per-event Script calls; expensive inside a tight loop - marshal once, outside the loop.