What is a Converge Action?
The Converge action is used to combine two or more paths together within an Actionflow, passing through attributes that are common to all incoming paths. It does not merge any records.
Converge actions are useful where data has been split to be processed separately but then needs to be brought back together for an action that only accepts one input, e.g. a Save action.
Creating Converge Actions
- Click and drag the icon from the toolbar onto the canvas Converge
- Enter a name for the Converge action, then select Create Action
- In the Converge Action on the right, click the Properties icon in the Output Attributes section to add new attributes, if required
- Connect to the Converge action by hovering over each input action node and selecting out, then create a new input connection point on the Converge action
Output Attributes
The Converge Node will only pass through attributes that are common to all paths, therefore, use Output Attributes to converge attributes to a common name. Once created, map to the Output Attributes using the attributes from incoming paths.
To check if a record in an Actionflow has a value mapped to an Output Attribute in a Converge Node, use the ifUnavailable function in a action. See Calculate1.11 Calculate Action Configuration.
For example, if there are three paths being passed into a Converge Node, and one of the paths does not have an attribute mapped to an output attribute, trying to reference that output attribute later in the Actionflow will throw an error on a record where there was no attribute mapped. The ifUnavailable function can be used to capture and handle this scenario.
Worked Example
Here's a worked example using the Shop Data (available from the Learning Centre).
In this example, we are using:
- A Customer Form screen containing blank input fields, set up to create a new customer - this screen was created using the Edit Form template
If you are completing this chapter as part of the Actionflow course and using a training instance, the data and screens have already been pre-loaded into the Actionflow Intermediate Application. For this example, we'll be working on the Save button on the Customer Form screen.
If you have completed 2.07 Embedded Actionflows prior to starting this worked example, ensure the Actionflow on the Save button on the Customer Form screen is d. Then re-add a simple Save Action using the Form Actions wizard. Remove
Process New Customers Differently Depending on Mailing List Subscription
For this example, we'll create an Actionflow that splits our data depending on if a new customer has joined a mailing list, allowing the customers who have joined to be processed separately. The new customer data for both the customer who have and haven't joined the mailing list is them converged back together so that the customer record can be updated with the current date and time (for the LastUpdated attribute), and the new customer record saved back to the table.
We recommend that you have prior knowledge of actions and Gateway actions or have completed Email2.03 Gateway Action Configuration and 2.05 Email Action Configuration.
Initial Setup
- Open the Customer Form and Unlock the screen
- Open the Actionflow on the Save button
- Click on the input connection point (under Connections) and map in the following attributes into the Actionflow:
- first_name
- LastUpdated
- mailingList
- Disconnect the input from the Save action on the canvas
Gateway Setup
- Create a action Gateway
- Name:
Mailing List
- Name:
- Drag the input node onto the Gateway action
- Map the mailingList attribute into the action on the in connector Gateway
- Click on the node to open its Properties Gateway
- Toggle on, Exclusive
- Modify the existing Rule and another Rule, as detailed below: Add
- Name: EmailMe
in.mailingList == true
- Name: DontEmailMe
in.mailingList != true
- the gateway settings Apply
Hover over the Gateway action to show the 2 output connections
- Click on DontEmailMe, then click on any white space on the canvas and use the popup menu to create a new
- Name:
CombineData
- Map across the customerID attribute
Converge action - Name:
- Repeat with the EmailMe output connection and create a new
- Name:
SendWelcomeEmail
Embedded Actionflow - Name:
- Click on DontEmailMe, then click on any white space on the canvas and use the popup menu to create a new
Embedded Actionflow Setup
- Click on the EmailMe connector and map in the attributes that will be needed to send a welcome email to the new customer:
- customerID
- first_name
- Hover over the Embedded Actionflow node and choose out to connect the SendWelcomeEmail Embedded Actionflow node to the CombineData
- After clicking on the Converge node, choose Add Input and name the connection
- Map across the customerID attribute
Converge action - Right-click on the SendWelcomeEmail Embedded Actionflow and choose Display
- On the SendWelcomeEmail Actionflow, create a new action Email
- Name:
WelcomeEmail
- Name:
- Connect the action Email input node to the
- Map the same attributes as above into the Email action
- Click on the Email Action to open its and Properties Pin the tab
- For the From field, we need to use the email address specified as the login email in your Outbound Emailer; to find this, in the , expand Full Repository Email Accounts
- Double-click on Outbound emailer and copy the login email
- Paste this into the From field on your pinned properties, and enter the following: Email
To:
${in.email}
Subject:
Welcome ${in.first_name}!
- is HTML: Toggle on
Message:
Hello ${in.first_name} and welcome to the PhixFlow Shop Newsletter. Thank you for joining our mailing list. We'll send you news and offers every week!
- Leave all other fields blank
- Apply and Close
- Hover over the Email action and select out
Click on the
output node under Connections to map the data back to the Save Actionflow
Converge & Calculate Setup
- Click back into the Actionflow for the Save button
- From the CombineData action Calculate
- Name:
SetLastUpdated
- Map the attribute, LastUpdated, into the action Calculate
Converge action, click out and create a - Name:
- On the Calculate action, add an Output Attribute:
- Name:
SetLastUpdated
- Type:
Datetime
Expression:
now()
- Name:
Save Setup
- Connect the Calculate action to the Save action
- Map across the customerID attribute from the Converge action to the Save
- Map across the SetLastUpdated attribute from the Calculate action to the LastUpdated attribute on the Save
Testing
To test the Actionflow we need to add two new customers.
- Close and reopen the Customer Form
- the screen and enter the details for a new customer, ensuring: Lock
- for the Email Address field, you enter your own email address
- for the "Would the customer like to join the mailing list?" field, you toggle the switch on
- After pressing Save, you should see the customer is saved on the Customer screen and you should receive an email
- Repeat these steps to create another customer, using your email address but this time, toggle off "Would the customer like to join the mailing list?"
- Check that the customer is still created and saved on the Customer screen but that no email is received