Casting in QuickActions - WolvenKit/CyberCAT GitHub Wiki

Sometimes objects need to be cast into the correct type. Otherwise the will only be accesible as a string.

If you encounter the error "The object has no suitable property or field name..." when accessing properties that you know should be on the object you probably need to cast it first.

This can be done by using the "cast" method of the predefined "host" object The first argument is the type. All types that are used in CyberCAT.Core can be accessed via the predefined "lib" object followed by the name of the type (including the full namespace.

In this example we cast the "Data" property of the "eddie" object into "SimpleItemData" which resides in the "CyberCAT.Core.Classes.NodeRepresentations.ItemData" namespace

var typedEddieData = host.cast(lib.CyberCAT.Core.Classes.NodeRepresentations.ItemData.SimpleItemData, eddies.Data);