See action history in running workflow inside of a loop

Le Thinh - Munich-MR 20 Reputation points
2025-11-14T12:56:07.7533333+00:00

Hello everyone,

we are using Azure Logic Apps to build our business process. To implement a retry mechanism for Azure Batch Account call we use a loop as you can see in the screenshot below. But it seems that if we use a loop to build that retry behavior we can't look into the run history of the actions inside of that loop. Is this a limitation of Logic App workflows or is there a way to see the actions which have been run? In the following case we know that the workflow is at the web hook "Wait for administrator" but we can't see the Input and Output of the previous action inside the loop. If there is no way is there another possibility to implement a retry mechanism where the workflows wait for user input / event before retry?

User's image

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
{count} votes

Answer accepted by question author
  1. Rakesh Mishra 3,790 Reputation points Microsoft External Staff Moderator
    2025-11-14T16:00:31.7+00:00

    Hi @Le Thinh - Munich-MR , Welcome to the Microsoft Q&A Platform! Thank you for asking your question here.

    Please find below possible solutions.

    1. Capture the final result to a variable (recommended when only final output needed)
      • Inside the Until loop, when you detect the task is completed, set a variable finalExitCode and (optionally) finalOutput from the Get Azure Batch job task action, then Terminate/exit the loop.
      • Example set-variable expression: setVariable('finalExitCode', outputs('Get_Azure_Batch_job_task')?['body/executionInfo/exitCode'])
      • Outside the loop use variables('finalExitCode') in your IF.
    2. Move the “Get task output” action outside the loop (clean separation)
      • Let the loop only poll for status. Once the loop finishes (status == completed), call Get Azure Batch job task output once, then use its outputs in the IF.
      • This ensures the output action is in the parent scope and its outputs are directly visible to downstream actions.
    3. Collect every iteration’s outputs if you need full history
      • Initialize an array variable iterationResults = []. Inside the loop append a small object each iteration: e.g., appendToArray('iterationResults', { iteration: variables('i'), state: body(...).state, exitCode: body(...).executionInfo.exitCode, timestamp: utcNow() }).
      • After the loop you’ll have every iteration’s payloads in variables('iterationResults') to inspect, store, or branch on.

    Please do let me know if any further question on this or do let me know if it works.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.