Skip to main content
Solved

Looping through a List in Automation Anywhere Process Composer

  • July 14, 2025
  • 6 replies
  • 114 views

Forum|alt.badge.img+6

Hello Comunity ,

I am designing a business process where a main bot retrieves a list of items from a source system. I then need to iterate through this list, and for each item, I want to call a separate bot to perform a specific action.

My initial approach was to use Process Composer to orchestrate this flow. However, after the first bot returns the list, I've realized there is no direct way within Process Composer to loop through the list items and execute another bot for each item.

What is the recommended best practice in Automation Anywhere Enterprise to achieve this kind of dynamic bot execution? How can I pass a list from a parent bot and use its contents to trigger a child bot for each list item?

Best answer by Aaron.Gleason

@LAHCEN AGLAGAL All your error handling will be within your task bot. One way to handle this is to have a Boolean variable and use a Loop to contain the functionality you want to restart if it fails:

$bSuccess$ = false

Loop… While $bSuccess$ = false

Try...

   (your functions here)

$bSuccess = true    // this is set true only if it got all the way through, otherwise it’s still false

End Try

End Loop

6 replies

DS78
Most Valuable Pathfinder
Forum|alt.badge.img+13
  • Most Valuable Pathfinder
  • July 14, 2025

You can use task bot for looping in through the list and based on the list items, you can then call subtask bot depending on your requirement.

You can pass the value as an input variable to the subtask as well.


I don't see the need of Process Composer here. You can explain in more detail if I am missing something.

 


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • July 14, 2025

@DS78 ​@LAHCEN AGLAGAL Correct, DS! You can perform some rudimentary looping using the Go To element within Process Composer, but Process Composer’s focus is really to direct the task bots, API tasks, forms, etc., and move data from one element to another. I recorded a video on this topic that should be live shortly.


Forum|alt.badge.img+6
  • Author
  • Navigator | Tier 3
  • July 14, 2025

@DS78  ​@Aaron.Gleason  Thank you for the guidance.

However, I'm concerned about error handling. I need a way to manage retries. For example, if a child bot fails, I want to restart the entire parent process from the beginning.

My initial thought was to use a "GO TO" action, which I know doesn't exist in Task Bots.


Aaron.Gleason
Automation Anywhere Team
Forum|alt.badge.img+14
  • Automation Anywhere Team
  • Answer
  • July 14, 2025

@LAHCEN AGLAGAL All your error handling will be within your task bot. One way to handle this is to have a Boolean variable and use a Loop to contain the functionality you want to restart if it fails:

$bSuccess$ = false

Loop… While $bSuccess$ = false

Try...

   (your functions here)

$bSuccess = true    // this is set true only if it got all the way through, otherwise it’s still false

End Try

End Loop


DS78
Most Valuable Pathfinder
Forum|alt.badge.img+13
  • Most Valuable Pathfinder
  • July 14, 2025

You can still do that by using a flag - a Boolean variable tracking the status for your bot success or failure.


Forum|alt.badge.img+6
  • Author
  • Navigator | Tier 3
  • July 14, 2025

@DS78 ​@Aaron.Gleason 
Thanks for your help. I'll try to come back to u