Converge Action Configuration

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

  1. Click and drag the  Converge icon from the toolbar onto the canvas
  2. Enter a name for the Converge action, then select Create Action
    1. In the Converge Action  Properties on the right, click the  icon in the Output Attributes section to add new attributes, if required
  3. 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  Calculate action. See 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 Retail 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 Embedded Actionflows prior to starting this worked example, ensure the Actionflow on the Save button on the Customer Form screen is  Removed. Then re-add a simple Save Action using the Form Actions wizard.

 How?

Right-click on the screen and choose  Add Form Actions.

Drag  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  Gateway actions and  Email actions or have completed Gateway Action Configuration and Email Action Configuration.

Initial Setup

  1. Open the Customer Form and  Unlock the screen
  2. Open the Actionflow on the Save button
  3. Click on the input connection point (under Connections) and map in the following attributes into the Actionflow:
    1. email
    2. first_name
    3. LastUpdated
    4. mailingList
  4. Disconnect the  input from the  Save action on the canvas

Gateway Setup

  1. Create a  Gateway action
    1. Name: Mailing List
  2. Drag the  input node onto the Gateway action
  3. Map the mailingList attribute into the  Gateway action on the in connector
  4. Click on the  Gateway node to open its Properties
    1. Toggle on, Exclusive
    2. Modify the existing Rule and  Add another Rule, as detailed below:
      1. Name: EmailMe
        in.mailingList == true
      2. Name: DontEmailMe
        in.mailingList != true
  5.  Apply the gateway settings
  6. Hover over the Gateway action to show the 2 output connections

    1. Click on DontEmailMe, then click on any white space on the canvas and use the popup menu to create a new  Converge action
      1. Name: CombineData
      2. Map across the customerID attribute
    2. Repeat with the EmailMe output connection and create a new  Embedded Actionflow
      1. Name: SendWelcomeEmail

         Checkpoint

Embedded Actionflow Setup

  1. Click on the EmailMe connector and map in the attributes that will be needed to send a welcome email to the new customer:
    1. customerID
    2. email
    3. first_name
  2. Hover over the Embedded Actionflow node and choose out to connect the SendWelcomeEmail Embedded Actionflow node to the CombineData  Converge action
    1. After clicking on the Converge node, choose Add Input and name the connection 
    2. Map across the customerID attribute
  3. Right-click on the SendWelcomeEmail Embedded Actionflow and choose  Display
  4. On the SendWelcomeEmail Actionflow, create a new  Email action
    1. Name: WelcomeEmail
  5. Connect the  input node to the  Email action
  6. Map the same attributes as above into the Email action
  7. Click on the Email Action to open its  Properties and  Pin the tab
  8. 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  Full Repository, expand  Email Accounts
    1. Double-click on  Outbound emailer and copy the login email 
  9. Paste this into the From field on your pinned  Email properties, and enter the following:
    1. To:

      ${in.email}
    2. Subject:

      Welcome ${in.first_name}!
    3. is HTML: Toggle off  
    4. 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!
      1. Leave all other fields blank
    5.  Apply and Close
  10. Hover over the Email action and select out
  11. Click on the  output node under Connections to map the data back to the Save Actionflow 

     Checkpoint

Converge & Calculate Setup

  1. Click back into the Actionflow for the Save button
  2. From the CombineData  Converge action, click out and create a  Calculate action
    1. Name: SetLastUpdated
    2. Map the attribute, LastUpdated, into the  Calculate action
  3. On the Calculate action, add an Output Attribute:
    1. Name: SetLastUpdated
    2. Type: Datetime
    3. Expression: now()

       Checkpoint


Save Setup

  1. Connect the Calculate action to the Save action
    1. Map across the customerID attribute from the Converge action to the Save
    2. Map across the SetLastUpdated attribute from the Calculate action to the LastUpdated attribute on the Save

       Checkpoint

Testing

To test the Actionflow we need to add two new customers. 

  1. Close and reopen the Customer Form
  2.  Lock the screen and enter the details for a new customer, ensuring:
    1. for the Email Address field, you enter your own email address
    2. for the "Would the customer like to join the mailing list?" field, you toggle the switch on 
  3. After pressing Save, you should see the customer is saved on the Customer screen and you should receive an email 
  4. 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?"
  5. Check that the customer is still created and saved on the Customer screen but that no email is received