For Each Entity

Allows building loops to perform some piece of logic for each entity in input. Works exclusively with Sugar Entities (e.g. Calls, Accounts, Cases, etc) in input.

It has two output control ports – loop body and completed. Control flow will keep coming back to this operator until all the entities in the input have gone through the same path down the loop body port. When finished with all the entities or when there are no entities in the input, it runs the control flow to the control flow link that is connected to its completed control port.

Assume that you have 2 entities in the input port entities in For Each Entity. Control Flow will go through links:

1 -> 2-> 3 -> 4 -> 1 -> 2 -> 3 -> 4 -> 5-> 6

inputs: 

entities – input records to walk through in the loop. Such records are usually obtained from Retrieve Entities By Attributes or Retrieve Related Entities operator. 

break  – connect control flow to this port, in order to break from the loop and move onto the operator, pointed to by “completed” control flow output. This port is often connected to one of the outputs of a Branch inside this loop’s body. 

In this example control flow will go through 1 -> 2-> 3-> 4-> 5 After 3 there is ‘break’ which means exit the loop:

Use ‘break’ only when it is needed to stop the loop prior it process all entities in the input. If there is no need to terminate the cycle under certain circumstances, just leave ‘break’ empty, and flow goes on the ‘completed’ path when all entities are processed. 

outputs: 

completed – flow goes here and proceeds to the following operators once all of the records are processed or when ‘break’ control flow input is reached. 

loop body – flow goes here and proceeds to the following operator for each record in the entities input until either all of the records are processed, or when ‘break’ control flow input is reached. After that, control flow proceeds via ‘completed’ port. 

entity – one given entity from the number of entities in the input of the current step of the loop. 

Click to rate this post!
[Total: 0 Average: 0]

Leave a Reply

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