Extending Data in Flow Using Dynamic VariablesLast Updated: 07/15/2016 Introduced in Verision: 2.0
In Decisions 3.2.0 users are able to extend Data Types with additional fields of any type. This is done by creating a specific Flow that accepts an Input of Type that needs to be extended and outputs Data that initial Type is going to be extended with.
In this example we will extend Account data type with GroupsForAccount field. GroupsForAccount field will be an Array of type Group.
We begin with navigating to the System > Designers > Toolbox Customization > Data Rules Folder in the Portal. Then, we click Add Data Extension button on the Folder Actions Panel.
In the resulting window we Name our Data Extension and click Create to proceed to the Flow Designer.
The Flow Designer informs user that this is a specific Flow that takes in a single type and outputs any number of extra variables that will be added to the type.
We select Start step on the workspace and using Step Information Layer we click Add New link under Flow Input Data.
In the Add Flow Input Data window we Name our input and pick Account type using Type picker. Click Ok to save and close this pop-up window.
Our Flow Input Data is added and we click Add Step button to start building our Flow.
Next, we add GetGroupsForAccount step from Integrations > All Integrations > Internal Services > GroupService category.
To configure this step we select it on the workspace and Step Information Layer pops up. We select Show Mapping Editor option.
In the Mapping Editor we expand Account Flow Input Data and connect AccountID to the accountId field. Click Ok to save and close Mapping Editor.
Back in the Flow Designer we connect the outcome from GetGroupsForAccount to the End Step in our Flow. Then, we select the End Step and click Add New link to add Output Data.
In the Add Data pop-up window we name our Output (which will be used as a new field in the initial type’s data tree), pick a Group type for this data, and check Is List and Can Be Null checkboxes. Click Ok to save and close this pop-up window.
Finally, we map the output from GetGroupsForAccount step to the Output Data we have just created.
This completes our Data Extension Flow so we can save and close Flow Designer.
Back in the Portal we are going to create a simple Flow to demonstrate Account type Data Extension we have created. We navigate to the Designer Folder and click Create Flow button on the Folder Actions Panel.
Next, we Name the Flow and click Create to proceed to the Flow Designer.
In the Flow Designer we add GetAll step from the Integrations > All Integrations > Internal Services > AccountService category.
Then, we add For Each Element step from the Favorite Steps category next to the GetAll step in our Flow.
In the resulting pop up window we pick GetAll_Output as the collection for our For Each Element step and click Add.
In this Flow we are going to show a pop up Notification for each Account in the system with all Groups for that Account. We add Show Popup step from the Favorite Steps on the Next outcome from the For Each Element step.
Next, we connect steps in our Flow in the following manner and Show Mapping Editor for Show Popup step.
In the Mapping Editor we expand Item category (which is a single Account from the collection) and connect EmailAddress to the Subject field in the Show Popup step. Mention, we have GroupsForAccount Item field which is an array of Group type. This is Account Data Extension we have created previously in this tutorial. Because Message field of Show Popup step is a String we will use Merge String List To Single String converter Flow as Mapping Type to be able to display all Groups in the Message field.
Then, we expand GroupsForAccount field and connect list of Group Name [Group Information] to the List Of Strings input in our Converter Flow. Next, we define a desirable Separator in the Converter Flow. When finished, we can click Ok to save and close Mapping Editor.
This completes our Flow. We can click Debug Flow link on the top panel of the Flow Designer to test our Flow.
Note that in Decisions version 3.5 and above, you’ll need to click Test Flow to access this process.
The Flow runs in the Debugger with no issues and we can see a pop-up Notification for each Account in the System with Groups this Account belongs to.