Create A Map To Delete Tutorial Data From Salesforce
Integration Solution Tutorial
Integration Maps can be used to integrate data from one datastore to another while simultaneously transforming that data using formulas, such as merging fields, adding a suffix, modifying a data type, truncating a field, or removing whitespace. In this lesson we need to delete unwanted data from a datastore. Create an Integration Map to filter Salesforce lead records and remove the tutorial data added from the Text Source files in the previous lessons.
Objectives
Learn how to:
- Create an Integration Map
- Use the same connection for both Source and Target to do housekeeping
- Filter data
- Use the Batch Processing option
- Use Matching Criteria
- Debug the Integration Map
Add A Map
- Select Solutions from the Menu bar.
- On the Solutions page, select Add
and then Integration to start your new Solution.
Solutions Page — Add Solution
- At the top of the Solution Edit page, enter Delete Tutorial Leads in the Name field.
- Select your On-Premise Agent from the Agent drop-down.
- In the Maps section, select Create Integration Map from the Menu
to display the Create Map dialog.
- In the Name field on the Map dialog, enter Delete Text Leads.
- In the Description field enter, Removing Leads From Salesforce.
- In the Connection panel on the left, select the Add Connection link.
- On the Add a Connection dialog select the SF Tutorial Connection created in the lesson titled Configure A Salesforce Connection.
- Select OK to add the Connection to the Map.
In this case, you only need one Connection. The SF Tutorial Connection serves as both the Source, when you Query, and the Target, when you Delete.
- Under the SF Tutorial Connection select and drag a Query Block onto the workspace.
- 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.
- On the General tab, select Lead in the Entity drop-down.
- Select the Filter tab and select the Add
button.
- In the Field drop-down select Website.
- Make sure the Operator is set to equals.
- In the Value field type "Scribe Tutorial", including the quotes.
Edit Query Block — Filter Tab
- Select the Preview tab. You should have 15 records. These are the records added in the previous lessons, located by the filter for "Scribe Tutorial".
Edit Query Block — Preview Tab
- Select OK to save your changes to the Query Block properties.
- Drag the For Each Result Block on to the Map 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 Map cannot execute.
- Under the SF Tutorial Connection select a Delete Block and drop it inside the For Each Result Block. The Delete block has a red icon on the corner because it has not been configured.
Map — Delete Block
- Select the General link on the Properties tab to open the Block Properties dialog for the Delete Block.
- On the General tab, select Lead in the Entity drop-down.
- Enable the Batch Processing check box. Batch processing reduces the number of API calls by grouping records together in a batch before updating the target. See Batch Processing for additional information.
Edit Delete Block — General Tab
- Select the Matching Criteria tab. Matching Criteria is used to locate the specific record in the target data that matches the source record being processed. This ensures that the correct record in the target is updated or deleted.
- Select the Add
button to add Matching Criteria.
- In the Field drop-down select Id. This is the Id field for the record in the target datastore.
- Make sure the Operator is set to equals.
- Select the Formula icon
Value field to open the Formula Editor.
Formula Editor — Source Field For Matching Criteria
- In the Categories panel select Source > Lead.
- In the Fields panel locate Id and select the Insert icon
. Lead.Id displays in the Formula field. This is the Id field for the source record.
- Select OK.
The Matching Criteria is used to make sure that the source record matches the target record before any action is taken on the target record.
Tip: In this case, we could not use "Scribe Tutorial" as our Matching Criteria because 15 records would match the single record given to the Delete Block. By taking the Lead.Id field in the source record, and matching it to the Id field of a record in the target, TIBCO Scribe® Online can narrow down the 15 records returned by the Query to the specific record that should be modified or deleted.
Edit Delete Block — Matching Criteria
- Select OK to save the Delete block configuration.
- Select OK to save and close the Map.
Debug A Map
Use the Map, Delete Text Leads, created in the previous section, to learn about Debug. Debug goes through the Map one Block at a time and displays the results of each step for a single record from the Query. If the Map executes successfully, the record used for debug is modified in the target datastore.
- On the Solutions page, open the Delete Tutorial Leads Solution.
- In the Maps section, select the Delete Text Leads Map to open it.
- Select Debug Mode at the top of the workspace.
- Select Start to begin the Debug process. Debug goes through the Query Block, selects the first record that matches the criteria configured for Query, and displays the record information in the Inputs panel.
Debug Inputs For Query Block
- Select Next to move through the next Block in the Map. Debug stops after the For Each Result Block and displays the lookup results used to fulfill the requirements of the Delete Block.
Debug Results For Delete Block Matching Criteria
- Click the Next button to move through the Delete block in the map. Debug stops after the Delete block. Select the Results tab to display the record that was deleted in the results panel. Only fields used in the Map are displayed. Fields associated with the deleted record, but not used in the Map, are not displayed.
Debug Results — Deleted Record
- Select Stop to stop the Debug process.
- Select OK to close and save the Map.
- Select the Run button at the top of the Delete Tutorial Leads Solution. Any remaining Tutorial Leads records stored in Salesforce are deleted as the Solution executes.
- Scroll to the bottom of the Solution page, to view the Execution History for your Solution. The total records processed should match the original 15 records from the Query Preview, minus the number of records deleted during your Debug session.
Each time you successfully ran Debug, you deleted one record. If you encountered errors during your Debug session, those errors display in the Execution History when you select the Info icon
.
Delete Tutorial Leads Solution — Execution History Detail
Return to Integration Solution Hands-On Tutorial to select the next lesson.