SerializableDynamicObject

When a component in Forms Builder contains properties, which are not defined in a known type, the Model value needs to be bound to an argument of type SerializableDynamicObject[] which is an array of SerializableDynamicObject objects.

Example

Calendar/Scheduler Initialized by Model Data

What exactly is a serializable dynamic object array? Let's break it down.

Dynamic Objects

Dynamic objects expose properties at run time, instead of at compile time. This enables you to create objects with property names that are not previously defined.

For example, you may have data such as XML or JSON where the members aren’t known ahead of time. The dynamic object type enables you to work with the objects and access their properties at run time.

Serializable Objects

An object can contain named properties with values that can themselves be objects or arrays. When an object is serializable, it can be converted to a string representation of the object. A string, as a sequence of characters, is easily transported across the Internet through web services. At its destination, it can be deserialized into the original object. The most efficient string representation of an object is a JSON string and is the format mainly used in Forms Builder.

Dictionary Objects

A Dictionary object is used to store information in name/value pairs (sometimes referred to as key and item value).

Since a dynamic object has properties whose names are not known until run time, a dictionary allows us to store the property name as a string (the key) and its value. Its value must be a known primitive type, like a string, integer, byte, etc., because these are easily deserialized. A SerializableDynamicObject has a Dictionary property called “DataDictionary”.

As an example, consider an object that has the following two properties with values.

“Property1” : “Value1”,

“Property2” : 234

Assuming an argument with name “mySerializableDynamicObject”, the values of the original object from the form web page can be accessed in a workflow as:

mySerializableDynamicObject.DataDictionary(“Property1”) => “Value1” (a string)

mySerializableDynamicObject.DataDictionary(“Property2”) => 234 (an Int32)

Values can also be set (with an Assign activity) and sent back to the form web page.

mySerializableDynamicObject.DataDictionary(“Property2”) = 987 (In this case an Int32 integer has been assigned.)