Create A Flow To Integrate Leads Into The Sample CRM Database

On Schedule App Tutorial

Integration flows are used for source to target integrations. In an Integration flow you configure connections to your source and target datastores, add operation blocks to your flow, and link data fields between the two datastores. Use the instructions below to create an Integration flow.

Flows are contained within apps that consist of the agent used to execute the flows, the flows themselves, and the schedule for running the app.

Objectives

Learn how to:

Add An Integration Flow

  1. Select Apps from the menu to open the apps list.
  2. On the apps page, select the Create/Import button to add your new app.

    Create or Import Button

    Apps Page — Create/Import App

  3. Select All app types>Create a Scheduled app.

    Create scheduled app

  4. You can change the name of the app using the top left corner option. Select your TIBCO Cloud™ Integration - Connect Agent from the Agent drop-down.
    Tip: The TIBCO Cloud™ Integration - Connect agent is named using the name of your computer. For example, if the name of your computer is Ferrari, then the name of your agent is Ferrari Agent. If you have more than one Agent installed, a number is appended to the name.

    Sample Marketing App

  5. Select New Flow>Integration Flow.

    New Integration Flow Button

  6. You can rename the Flow using the top left corner option.

    Flow rename option

  7. In the Connection panel on the left, select the Add Connection link.

    Add source connection to a flow

  8. In the Add a Connection dialog, select the MarketingTest Connection created in the lesson titled Configure A Sample Marketing Connection from the drop-down and select OK to add the Connection to the Flow or click Create a New Connection to create a new one.

    Add source connection to a flow

  9. Under the MarketingTest Connection on the left, select the Query Block and drag it on to the Flow workspace.
  10. Select the General link on the Properties tab on the right side of the workspace. The Query Block Properties dialog displays with the General tab selected.

    query_block

  11. In the Entity field, select Leads.

    Query Block General Field

  12. In the Connections panel on the left, scroll up to the Controls section and select the For Each Result Block.
  13. Drag the For Each Result Block onto the Flow and put it under the Query Block. Make sure the Blocks are attached. If the For Each Result Block is transparent, as shown in the image below, it is not attached to the Query Block and the Flow cannot execute. The For Each Result block processes the results of the Query block one record at a time. For example, if the query returns 10 records, the For Each Result block takes the first record returned and runs it through any blocks contained inside the For Each Result block. Then, the next record is picked up and processed.

    For Each result Block Placement

  14. In the Connection panel on the left, select the Add Connection link.
  15. In the Add a Connection dialog, select the CRMTest Connection created in the lesson titled Configure A Sample CRM Connection from the drop-down and select OK to add the Connection to the Flow.

    Add Target Connection to the flow

  16. Under the CRMTest Connection on the left, select the Update/Insert Block and place it inside the For Each Result Block. The Update/Insert Block has an error icon Configuration Errorindicating that it has not been configured or contains invalid information.

    Update Block Configuration Error

  17. Select the Errors and Warnings tab in the Flow workspace on the right panel to review the cause of the Error. The error information indicates that you have not selected an entity for the Update/Insert Block. You can see the same information on the Errors and Warnings tab in the Block Properties.

    Error description

    Errors And Warnings Tab — Flow Workspace

    Update Block Error Tab

  18. Select the error in the Errors and Warnings tab on the Flow workspace to highlight the Block to which it refers.
  19. Open the Block Properties for the Update/Insert Block and select the CRM_Customer entity. The Error, Warnings tab indicates there are problems. This is normal because you are still missing configuration information.
  20. Select the MatchingCriteria tab to compare duplicate records from the source with the records in the target database.
    1. Select Add symbol.
    2. On the left side, select ID from the drop-down.
    3. On the right side under the Value, select Formula icon to open the Formula Editor Formula symbol.
    4. Select Categories>Source>Marketing_Leads.
    5. In the Formula Editor, select Add symbol icon next to the ID under the Source.
    6. Select OK.

    Update Block Matching Criteria Tab

    Matching Criteria Tab

  21. Select the Fields tab to display the source and target fields associated with the entities you selected in the Query and Update/Insert Blocks. Use the Fields tab to link fields from the source to fields in the target. Links can be simple or contain complex formulas that use the TIBCO Cloud™ Integration function library, operators, source fields, and constants to transform data during an integration.

    Update Block Fields Tab

  22. Select COUNTRY in the source list, drag it to the target list and drop the field onto the Country field. Now those two fields are linked. When the flow runs, data in the COUNTRY field is placed in the Country field in Sample CRM.
  23. Link the following fields manually as follows:
    1. Drag EMAIL to Email
    2. Drag GENDER to Gender
    3. Drag ID to ID
  24. In the Source, the CONTACTNAME field contains the Lead's First and Last names. In the Target, each part of the Lead's name is stored in a separate field. To integrate the data correctly, you must use a formula to return individual parts of the name, and place First, and Last names in the appropriate target fields. Drag CONTACTNAME to Lastname, which is a required field.
    1. Select the Formula icon Formula symbol next to LastName in the Formula column to display the Formula editor.
    2. Highlight Marketing_Leads in the Formula panel.
    3. In the Categories panel select Functions>All.
    4. In the Functions panel locate PARSENAME and select the Insert icon Add button.
    5. The Description panel provides information about how to use the PARSENAME function.
    6. The Formula panel contains the PARSENAME function with the Marketing_Leads.CONTACTNAME field in parenthesis.
    7. After Leads.CONTACTNAME type a comma and "L" for Last Name. This indicates that the PARSENAME function should return the Last Name information from the CONTACTNAME field. The entire function should be as follows:PARSENAME(Marketing_Leads.CONTACTNAME, "L")
    8. Select Validate to make sure the format of the formula is correct.
    9. Review the message above the Formula field.
    10. Select OK to save the formula in the target Lastname field.

    Parse Name Function for Last Name

  25. Drag CONTACTNAME to Firstname and repeat the process for adding a formula to return just the First name. When you are finished mapping fields, the Target panel should have links for all of the Source fields except Category.

    Parse Name For First Name

    Linked Fields

  26. In the Target field list, scroll down to the Category field and in the Formula field type "Connect Tutorial", including the quotation marks. Adding "Connect Tutorial" to this field marks the records added to Sample CRM as part of the Tutorial. Later you can use this field as a filter to locate and delete the records added during the Tutorial.
  27. Select OK to save the Insert Marketing Leads Flow and return to the Flows list on the App page.
  28. Select the Run Flow option from the menu Menu Button to run this single Flow.
  29. Select the Execution History tab to view the Execution History for your Flow. The Execution History indicates that 15 records were successfully processed.

    Execution History Status

  30. To see the processed records, open CRM.xlxs which is located at C:\Program Files (x86)\Scribe Software\Scribe Online Agent\Connectors\Sample.Connector.CRM or import it to a Google spreadsheet and go to the Customer sheet.

    Local CRM database

Return to On Schedule App Tutorial Overview to select the next lesson.