Construct
Creates a new object based on a set of user-defined inputs.
Input Fields
- (user created fields): Create one input for each key you want to create in the output object. The input names become the key names in the object that gets created. Each input can be set to any type, including object or list.
Output Fields
- output: The newly-constructed object
Example
You want to create an object to represent a customer. This object has 4 keys: First name, First name, Age, and Loyalty, the last key indicating if the customer is a member of your loyalty plan.
Using the function card, create inputs for each key name and set the input types. Both name fields default to text, but Age should be a number and Loyalty should be set to a true or false value:
You can drag in text fields to complete the card. If the flow runs for your customer Jane Smith, age 29, who is a loyalty member, you'd get an output object that looks like this:
You can build any object using this function. You can set the inputs to any type, including lists.
As an advanced use case, if you want to define one of the keys as an object and you also want to construct that object at runtime, you can use two object constructs. First define the inner object, then define the second object, setting one of the keys to be an object type. Finally, drag the output of the first card into the object key in the second card.