Capture workflow runID status

Gupta 0 Reputation points
2024-04-30T11:19:30.8466667+00:00

Hi All,

I am trying one scenario, My timer trigger will pick the files and send them to 3rd third-party SFTP location, but if the files are not present at the source location my Logicapp workflow should fail and re-try after 5 min. I am using delay action for retry after 5 min however in this case flow run status will not fail.

So I am trying to check the previous runID status, if the previous runid fails I will retrigger the flow else I will cancel it.

is there a way to capture the runid status..?

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,891 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Ryan Hill 26,236 Reputation points Microsoft Employee
    2024-04-30T22:30:08.86+00:00

    Hi @Gupta,

    You can use the List Workflow Runs REST API to get the status of prior workflow runs, see Workflow Runs - List - REST API (Azure Logic Apps) | Microsoft Learn. Another option is to create a monitor workflow; see Monitor workflow status, view run history, and set up alerts - Azure Logic Apps | Microsoft Learn, and use an alert based off the run history query and set the action to trigger a webhook trigger for your logic app.

    But rather than going that route, I suggest implementing a retry policy and force the logic app to fail. I would add a condition or scope after the SFTP connector, checking to see if body/value is > 0 and if it isn't, using a Terminate step within that scope or condition as failed. The following blog post, blog.atwork.at | Handle failed actions in Azure Logic Apps, illustrates a similar workflow.

    0 comments No comments