For Loop

Learn How to Add For Condition in your Workflow

Introduction

The "For" condition in DBSync Cloud Workflow allows users to create customized workflows by iterating over collections of data. This enables dynamic processing based on specific criteria, making it possible to perform various operations like insert, upsert, or update from a source to a target.

Prerequisites

Before you begin, ensure you have:

  • A configured project in DBSync Cloud Workflow.

  • The necessary connectors (for example, Salesforce and QuickBooks) set up.

Use Case

In this use case, we iterate through opportunity products to trigger item creation.

1

Configure the Flow

  • In the Flow screen, drag the Flow Action from the Actions palette on the left and drop to the center of the screen.

  • Click Configure on the flow panel to configure the flow.

  • In the Flow configuration panel that opens on the right side, enter the required description for the flow and click Save.

2

Add and configure a Query action

  • Drag and drop a Query action into the flow and Configure.

  • Define the Source as Salesforce and select your source connector. Select the Opportunity Object. Note: Ensure that you add the Related OpportunityLineItem.

  • Click Save.

3

Add the For condition and iterate

  • Drag and drop the For condition into the flow.

  • Configure the For condition to iterate over the products associated with the queried Opportunity. In the right panel, from the Records in dropdown, select OpportunityLineItems/Records. This allows you to process each product individually.

4

Transform, Write and Debug

  • Add a Transform and Write action to insert the items into QuickBooks using the relevant opportunity product data.

  • Add a Debug action to print the results of the operation. This will display a debug card with the details of the products associated with the Opportunity.

5

Run the workflow

  • Click Run to execute the workflow.

  • Monitor the console output to verify that the For loop is iterating correctly and that the appropriate actions are taken.

The Related Items will be created in QuickBooks.

circle-info

PRO TIP

When using the "For" condition, ensure that your data set is well-defined and that the items being iterated over are relevant to the operation you intend to perform. This will help avoid unnecessary iterations and improve workflow efficiency.

Related Content

Last updated