What is a Converge Action?
The Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
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.
Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
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 Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
action.
Creating Converge Actions
- Click and drag the
Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
icon from the toolbar onto the canvas - Enter a name for the Converge action, then select Create Action
- In the Converge Action
Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
|
on the right, click the Insert excerpt |
---|
| _add_icon |
---|
| _add_icon |
---|
nopanel | true |
---|
|
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
Insert excerpt |
---|
| _action_calculate |
---|
| _action_calculate |
---|
nopanel | true |
---|
|
action. See
1.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.
HTML Comment |
---|
|
Insert excerpt |
---|
| Converge Node |
---|
| Converge Node |
---|
nopanel | true |
---|
|
|
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
Tip |
---|
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 Insert excerpt |
---|
| _remove |
---|
| _remove |
---|
nopanel | true |
---|
| d. Then re-add a simple Save Action using the Form Actions wizard. Expand |
---|
| Right-click on the screen and choose Insert excerpt |
---|
| _actionflow_icon |
---|
| _actionflow_icon |
---|
nopanel | true |
---|
| Add Form Actions.Drag Insert excerpt |
---|
| _save_icon |
---|
| _save_icon |
---|
nopanel | true |
---|
| Save Record onto the Save button. |
|
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 Insert excerpt |
---|
| _action_gateway |
---|
| _action_gateway |
---|
nopanel | true |
---|
|
actions and Insert excerpt |
---|
| _action_email |
---|
| _action_email |
---|
nopanel | true |
---|
|
actions or have completed 2.03 Gateway Action Configuration and 2.05 Email Action Configuration.
Initial Setup
- Open the Customer Form and
Insert excerpt |
---|
| _unlock |
---|
| _unlock |
---|
nopanel | true |
---|
|
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:
- email
- first_name
- LastUpdated
- mailingList
- Disconnect the from the
Insert excerpt |
---|
| _action_save |
---|
| _action_save |
---|
nopanel | true |
---|
|
action on the canvas
Gateway Setup
- Create a
Insert excerpt |
---|
| _action_gateway |
---|
| _action_gateway |
---|
nopanel | true |
---|
|
action- Name:
Mailing List
- Drag the node onto the Gateway action
- Map the mailingList attribute into the
Insert excerpt |
---|
| _action_gateway |
---|
| _action_gateway |
---|
nopanel | true |
---|
|
action on the in connector - Click on the
Insert excerpt |
---|
| _action_gateway |
---|
| _action_gateway |
---|
nopanel | true |
---|
|
node to open its Properties- Toggle on, Exclusive
- Modify the existing Rule and
Insert excerpt |
---|
| _add |
---|
| _add |
---|
name | add |
---|
nopanel | true |
---|
|
another Rule, as detailed below:
Code Block |
---|
theme | Emacs |
---|
title | Name: EmailMe |
---|
|
in.mailingList == true |
Code Block |
---|
theme | Emacs |
---|
title | Name: DontEmailMe |
---|
|
in.mailingList != true |
- the gateway settings
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
Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
action- Name:
CombineData
- Map across the customerID attribute
- Repeat with the EmailMe output connection and create a new
Insert excerpt |
---|
| _actionflow_icon |
---|
| _actionflow_icon |
---|
nopanel | true |
---|
|
Embedded ActionflowName: SendWelcomeEmail
Expand |
---|
|
|
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
- email
- first_name
- Hover over the Embedded Actionflow node and choose out to connect the SendWelcomeEmail Embedded Actionflow node to the CombineData
Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
action- After clicking on the Converge node, choose Add Input and name the connection
- Map across the customerID attribute
- Right-click on the SendWelcomeEmail Embedded Actionflow and choose
Insert excerpt |
---|
| _actionflow_display |
---|
| _actionflow_display |
---|
name | display |
---|
nopanel | true |
---|
|
- On the SendWelcomeEmail Actionflow, create a new
Insert excerpt |
---|
| _action_email |
---|
| _action_email |
---|
nopanel | true |
---|
|
action- Name:
WelcomeEmail
- Connect the node to the
Insert excerpt |
---|
| _action_email |
---|
| _action_email |
---|
nopanel | true |
---|
|
action - Map the same attributes as above into the Email action
- Click on the Email Action to open its
Insert excerpt |
---|
| _property_settings |
---|
| _property_settings |
---|
nopanel | true |
---|
|
and 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
Insert excerpt |
---|
| _repository |
---|
| _repository |
---|
name | full |
---|
nopanel | true |
---|
|
, expand Insert excerpt |
---|
| _emailConfiguration |
---|
| _emailConfiguration |
---|
name | accounts |
---|
nopanel | true |
---|
|
- Double-click on
Insert excerpt |
---|
| _emailConfiguration |
---|
| _emailConfiguration |
---|
name | icon |
---|
nopanel | true |
---|
|
Outbound emailer and copy the login email
- Paste this into the From field on your pinned
Insert excerpt |
---|
| _action_email |
---|
| _action_email |
---|
nopanel | true |
---|
|
properties, and enter the following:To:
Subject:
Code Block |
---|
|
Welcome ${in.first_name}! |
- is HTML: Toggle on off
Insert excerpt |
---|
| _toggle_off |
---|
| _toggle_off |
---|
nopanel | true |
---|
|
Message:
Code Block |
---|
|
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
Insert excerpt |
---|
| _finish |
---|
| _finish |
---|
nopanel | true |
---|
|
- Hover over the Email action and select out
Click on the
Insert excerpt |
---|
| _output |
---|
| _output |
---|
nopanel | true |
---|
|
node under Connections to map the data back to the Save Actionflow Expand |
---|
|
|
Converge & Calculate Setup
- Click back into the Actionflow for the Save button
- From the CombineData
Insert excerpt |
---|
| _action_converge |
---|
| _action_converge |
---|
nopanel | true |
---|
|
action, click out and create a Insert excerpt |
---|
| _action_calculate |
---|
| _action_calculate |
---|
nopanel | true |
---|
|
action- Name:
SetLastUpdated
- Map the attribute, LastUpdated, into the
Insert excerpt |
---|
| _action_calculate |
---|
| _action_calculate |
---|
nopanel | true |
---|
|
action
- On the Calculate action, add an Output Attribute:
- Name:
SetLastUpdated
- Type:
Datetime
Expression: now()
Expand |
---|
|
|
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
Expand |
---|
|
|
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:
- 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
2.11 Custom Validation