Getting bored with repeating the same tasks for different customers every day? Now you can automate them by using the ‘For each’ node in App Connect, which is available for both event-driven and API flows.

In the following example, we’re going to create an API flow that can update or create Salesforce accounts for all existing customers in NetSuite.

After the setup of an API flow, we can now add a node to retrieve up to 20 existing customers from NetSuite. (We could also configure the node to retrieve customers that meet specific conditions by using the button. But for this example, we want to retrieve any customers, so we don’t need to add any conditions.)

Then we’ll add a ‘For each’ node from the ‘Logic’ tab:

We set the collection of items to be processed by this ‘For each’ node to be the from the retrieve node that we have just created (you can type in JSONata expressions to generate your customized input collection for a ‘For each’ node).
To help us distinguish this node, we can edit the display name of it to be ‘For each: NetSuite ERP Customer’.

Also, we can choose which mode this ‘For each’ node should run in: either ‘sequentially’ or ‘in parallel’.
Note: If you choose to run a ‘For each’ node in parallel, you may want to check that the applications that are used in the ‘For each’ node can handle a large number of API calls in a short period.

In the branch of the ‘For each’ node, we then add other nodes to carry out the tasks for each customer. We will have access to the properties in a ‘customer’ object on the ‘For each’ branch to help us to configure the field mappings.

Finally, we can add another retrieve node to retrieve the contacts for each customer, and another ‘For each’ node to update or create the retrieved contacts in Salesforce:

Our flow is ready to go! When it gets invoked, the flow will first retrieve all customers from NetSuite. Then, for each customer, it will update or create an account in Salesforce, and retrieve contacts from NetSuite. Finally, for each contact, the flow will update or create a contact in Salesforce. We can now say goodbye to this repeated task!

Want to try it out yourself? Sign up today here.

1 comment on"Unleash the power of the ‘For each’ node in IBM App Connect"

  1. Rob Nicholson September 01, 2017

    Hi Cheng, it would be great to have a follow on blog post where you explore some advanced cases where you use JSONata expressions to create custom input collections.

Join The Discussion

Your email address will not be published. Required fields are marked *